From 17695e2ccb85ded8d14278d37c292fbb8d0f5cd2 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Mon, 3 May 2021 20:18:53 +0200 Subject: [PATCH 1/3] all are optional --- src/types/webhooks/execute_webhook.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/types/webhooks/execute_webhook.ts b/src/types/webhooks/execute_webhook.ts index 4e3a956a0..f668a0906 100644 --- a/src/types/webhooks/execute_webhook.ts +++ b/src/types/webhooks/execute_webhook.ts @@ -16,11 +16,11 @@ export interface ExecuteWebhook { /** True if this is a TTS message */ tts?: boolean; /** The contents of the file being sent */ - file: FileContent | FileContent[]; + file?: FileContent | FileContent[]; /** Embedded `rich` content */ - embeds: Embed[]; + embeds?: Embed[]; /** Allowed mentions for the message */ - allowedMentions: AllowedMentions; + allowedMentions?: AllowedMentions; } export type DiscordExecuteWebhook = SnakeCasedPropertiesDeep< From 9be445a2e8df269fec8e49974b1711ddea7047f9 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Mon, 3 May 2021 20:19:38 +0200 Subject: [PATCH 2/3] now takes bigint --- tests/messages/delete_messages.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/messages/delete_messages.ts b/tests/messages/delete_messages.ts index 6d7a2d7e5..af0041931 100644 --- a/tests/messages/delete_messages.ts +++ b/tests/messages/delete_messages.ts @@ -1,7 +1,7 @@ import { cache, deleteMessages, sendMessage } from "../../mod.ts"; -import { defaultTestOptions, tempData } from "../ws/start_bot.ts"; import { assertExists } from "../deps.ts"; import { delayUntil } from "../util/delay_until.ts"; +import { defaultTestOptions, tempData } from "../ws/start_bot.ts"; async function ifItFailsBlameWolf(reason?: string) { const message = await sendMessage(tempData.channelId, "Hello World!"); @@ -29,7 +29,7 @@ async function ifItFailsBlameWolf(reason?: string) { // Delete the message now await deleteMessages( tempData.channelId, - [message.id.toString(), secondMessage.id.toString()], + [message.id, secondMessage.id], reason, ); From 000aaaaa51c20290ee5a2a1581303681cd68c2ac Mon Sep 17 00:00:00 2001 From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> Date: Mon, 3 May 2021 18:33:55 +0000 Subject: [PATCH 3/3] add isBot, and tag to message struct --- src/structures/message.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/structures/message.ts b/src/structures/message.ts index 02bdaa7d9..47a798594 100644 --- a/src/structures/message.ts +++ b/src/structures/message.ts @@ -161,6 +161,8 @@ export async function createDiscordenoMessage(data: Message) { } props.authorId = createNewProp(snowflakeToBigint(author.id)); + props.isBot = createNewProp(author.bot || false); + props.tag = createNewProp(`${author.username}#${author.discriminator}`); // Discord doesnt give guild id for getMessage() so this will fill it in const guildIdFinal = guildId || @@ -221,8 +223,14 @@ export interface DiscordenoMessage extends | "guildId" | "channelId" | "member" + | "author" > { id: bigint; + author: undefined; + /** Whether or not this message was sent by a bot */ + isBot: boolean; + /** The username#discrimnator for the user who sent this message */ + tag: string; // For better user experience /** Id of the guild which the massage has been send in. "0n" if it a DM */ guildId: bigint;