From d87d66649eff3270420ba3ed1bbcda4afed0f6c4 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 4 May 2021 21:02:16 +0200 Subject: [PATCH 01/15] big to small --- src/types/audit_log/audit_log_events.ts | 70 +++++++++---------- src/types/channels/overwrite_types.ts | 4 +- src/types/gateway/gateway_intents.ts | 30 ++++---- .../default_message_notification_levels.ts | 4 +- .../guilds/explicit_content_filter_levels.ts | 6 +- .../get_guild_widget_image_style_options.ts | 10 +-- src/types/guilds/guild_features.ts | 32 ++++----- src/types/guilds/mfa_levels.ts | 4 +- src/types/guilds/premium_tiers.ts | 8 +-- src/types/guilds/system_channel_flags.ts | 6 +- src/types/guilds/verification_levels.ts | 10 +-- .../application_command_option_types.ts | 18 ++--- src/types/invites/target_types.ts | 4 +- src/types/messages/message_activity_types.ts | 8 +-- .../messages/message_sticker_format_types.ts | 6 +- src/types/misc/activity_flags.ts | 12 ++-- src/types/teams/team_membership_states.ts | 4 +- 17 files changed, 118 insertions(+), 118 deletions(-) diff --git a/src/types/audit_log/audit_log_events.ts b/src/types/audit_log/audit_log_events.ts index 0620c1465..88f35fa3f 100644 --- a/src/types/audit_log/audit_log_events.ts +++ b/src/types/audit_log/audit_log_events.ts @@ -1,40 +1,40 @@ /** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events */ export enum DiscordAuditLogEvents { - GUILD_UPDATE = 1, - CHANNEL_CREATE = 10, - CHANNEL_UPDATE, - CHANNEL_DELETE, - CHANNEL_OVERWRITE_CREATE, - CHANNEL_OVERWRITE_UPDATE, - CHANNEL_OVERWRITE_DELETE, - MEMBER_KICK = 20, - MEMBER_PRUNE, - MEMBER_BAN_ADD, - MEMBER_BAN_REMOVE, - MEMBER_UPDATE, - MEMBER_ROLE_UPDATE, - MEMBER_MOVE, - MEMBER_DISCONNECT, - BOT_ADD, - ROLE_CREATE = 30, - ROLE_UPDATE, - ROLE_DELETE, - INVITE_CREATE = 40, - INVITE_UPDATE, - INVITE_DELETE, - WEBHOOK_CREATE = 50, - WEBHOOK_UPDATE, - WEBHOOK_DELETE, - EMOJI_CREATE = 60, - EMOJI_UPDATE, - EMOJI_DELETE, - MESSAGE_DELETE = 72, - MESSAGE_BULK_DELETE, - MESSAGE_PIN, - MESSAGE_UNPIN, - INTEGRATION_CREATE = 80, - INTEGRATION_UPDATE, - INTEGRATION_DELETE, + GuildUpdate = 1, + ChannelCreate = 10, + ChannelUpdate, + ChannelDelete, + ChannelOverwriteCreate, + ChannelOverwriteUpdate, + ChannelOverwriteDelete, + MemberKick = 20, + MemberPrune, + MemberBanAdd, + MemberBanRemove, + MemberUpdate, + MemberRoleUpdate, + MemberMove, + MemberDisconnect, + BotAdd, + RoleCreate = 30, + RoleUpdate, + RoleDelete, + InviteCreate = 40, + InviteUpdate, + InviteDelete, + WebhookCreate = 50, + WebhookUpdate, + WebhookDelete, + EmojiCreate = 60, + EmojiUpdate, + EmojiDelete, + MessageDelete = 72, + MessageBulkDelete, + MessagePin, + MessageUnpin, + IntegrationCreate = 80, + IntegrationUpdate, + IntegrationDelete, } export type AuditLogEvents = DiscordAuditLogEvents; diff --git a/src/types/channels/overwrite_types.ts b/src/types/channels/overwrite_types.ts index 5ee32e76d..9e4de3406 100644 --- a/src/types/channels/overwrite_types.ts +++ b/src/types/channels/overwrite_types.ts @@ -1,6 +1,6 @@ export enum DiscordOverwriteTypes { - ROLE, - MEMBER, + Role, + Member, } export type OverwriteTypes = DiscordOverwriteTypes; diff --git a/src/types/gateway/gateway_intents.ts b/src/types/gateway/gateway_intents.ts index 533556a17..cb7f43944 100644 --- a/src/types/gateway/gateway_intents.ts +++ b/src/types/gateway/gateway_intents.ts @@ -11,63 +11,63 @@ export enum DiscordGatewayIntents { * - CHANNEL_DELETE * - CHANNEL_PINS_UPDATE */ - GUILDS = 1 << 0, + Guilds = 1 << 0, /** * - GUILD_MEMBER_ADD * - GUILD_MEMBER_UPDATE * - GUILD_MEMBER_REMOVE */ - GUILD_MEMBERS = 1 << 1, + GuildMembers = 1 << 1, /** * - GUILD_BAN_ADD * - GUILD_BAN_REMOVE */ - GUILD_BANS = 1 << 2, + GuildBans = 1 << 2, /** * - GUILD_EMOJIS_UPDATE */ - GUILD_EMOJIS = 1 << 3, + GuildEmojis = 1 << 3, /** * - GUILD_INTEGRATIONS_UPDATE * - INTEGRATION_CREATE * - INTEGRATION_UPDATE * - INTEGRATION_DELETE */ - GUILD_INTEGRATIONS = 1 << 4, + GuildIntegrations = 1 << 4, /** Enables the following events: * - WEBHOOKS_UPDATE */ - GUILD_WEBHOOKS = 1 << 5, + GuildWebhooks = 1 << 5, /** * - INVITE_CREATE * - INVITE_DELETE */ - GUILD_INVITES = 1 << 6, + GuildInvites = 1 << 6, /** * - VOICE_STATE_UPDATE */ - GUILD_VOICE_STATES = 1 << 7, + GuildVoiceStates = 1 << 7, /** * - PRESENCE_UPDATE */ - GUILD_PRESENCES = 1 << 8, + GuildPresences = 1 << 8, /** * - MESSAGE_CREATE * - MESSAGE_UPDATE * - MESSAGE_DELETE */ - GUILD_MESSAGES = 1 << 9, + GuildMessages = 1 << 9, /** * - MESSAGE_REACTION_ADD * - MESSAGE_REACTION_REMOVE * - MESSAGE_REACTION_REMOVE_ALL * - MESSAGE_REACTION_REMOVE_EMOJI */ - GUILD_MESSAGE_REACTIONS = 1 << 10, + GuildMessageReactions = 1 << 10, /** * - TYPING_START */ - GUILD_MESSAGE_TYPING = 1 << 11, + GuildMessageTyping = 1 << 11, /** * - CHANNEL_CREATE * - MESSAGE_CREATE @@ -75,18 +75,18 @@ export enum DiscordGatewayIntents { * - MESSAGE_DELETE * - CHANNEL_PINS_UPDATE */ - DIRECT_MESSAGES = 1 << 12, + DirectMessages = 1 << 12, /** * - MESSAGE_REACTION_ADD * - MESSAGE_REACTION_REMOVE * - MESSAGE_REACTION_REMOVE_ALL * - MESSAGE_REACTION_REMOVE_EMOJI */ - DIRECT_MESSAGE_REACTIONS = 1 << 13, + DirectMessageReactions = 1 << 13, /** * - TYPING_START */ - DIRECT_MESSAGE_TYPING = 1 << 14, + DirectMessageTyping = 1 << 14, } export type Intents = DiscordGatewayIntents; diff --git a/src/types/guilds/default_message_notification_levels.ts b/src/types/guilds/default_message_notification_levels.ts index 5c639ebde..8c3ced807 100644 --- a/src/types/guilds/default_message_notification_levels.ts +++ b/src/types/guilds/default_message_notification_levels.ts @@ -1,9 +1,9 @@ /** https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level */ export enum DiscordDefaultMessageNotificationLevels { /** Members will receive notifications for all messages by default */ - ALL_MESSAGES, + AllMessages, /** Members will receive notifications only for messages that @mention them by default */ - ONLY_MENTIONS, + OnlyMentions, } export type DefaultMessageNotificationLevels = diff --git a/src/types/guilds/explicit_content_filter_levels.ts b/src/types/guilds/explicit_content_filter_levels.ts index 0fac226ed..583a2cdf4 100644 --- a/src/types/guilds/explicit_content_filter_levels.ts +++ b/src/types/guilds/explicit_content_filter_levels.ts @@ -1,11 +1,11 @@ /** https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level */ export enum DiscordExplicitContentFilterLevels { /** Media content will not be scanned */ - DISABLED, + Disabled, /** Media content sent by members without roles will be scanned */ - MEMBERS_WITHOUT_ROLES, + MembersWithoutRoles, /** Media content sent by all members will be scanned */ - ALL_MEMBERS, + AllMembers, } export type ExplicitContentFilterLevels = DiscordExplicitContentFilterLevels; diff --git a/src/types/guilds/get_guild_widget_image_style_options.ts b/src/types/guilds/get_guild_widget_image_style_options.ts index b5c36c335..27aa6d044 100644 --- a/src/types/guilds/get_guild_widget_image_style_options.ts +++ b/src/types/guilds/get_guild_widget_image_style_options.ts @@ -1,15 +1,15 @@ /** https://discord.com/developers/docs/resources/guild#get-guild-widget-image-widget-style-options */ export enum DiscordGetGuildWidgetImageStyleOptions { /** Shield style widget with Discord icon and guild members online count */ - SHIELD = "shield", + Shield = "shield", /** Large image with guild icon, name and online count. "POWERED BY DISCORD" as the footer of the widget */ - BANNER_1 = "banner1", + Banner1 = "banner1", /** Smaller widget style with guild icon, name and online count. Split on the right with Discord logo */ - BANNER_2 = "banner2", + Banner2 = "banner2", /** Large image with guild icon, name and online count. In the footer, Discord logo on the left and "Chat Now" on the right */ - BANNER_3 = "banner3", + Banner3 = "banner3", /** Large Discord logo at the top of the widget. Guild icon, name and online count in the middle portion of the widget and a "JOIN MY SERVER" button at the bottom */ - BANNER_4 = "banner4", + Banner4 = "banner4", } export type GetGuildWidgetImageStyleOptions = diff --git a/src/types/guilds/guild_features.ts b/src/types/guilds/guild_features.ts index c507bb5be..75582bb3f 100644 --- a/src/types/guilds/guild_features.ts +++ b/src/types/guilds/guild_features.ts @@ -1,37 +1,37 @@ /** https://discord.com/developers/docs/resources/guild#guild-object-guild-features */ export enum DiscordGuildFeatures { /** Guild has access to set an invite splash background */ - INVITE_SPLASH = "INVITE_SPLASH", + InviteSplash = "INVITE_SPLASH", /** Guild has access to set 384kbps bitrate in voice (previously VIP voice servers) */ - VIP_REGIONS = "VIP_REGIONS", + VipRegions = "VIP_REGIONS", /** Guild has access to set a vanity URL */ - VANITY_URL = "VANITY_URL", + VanityUrl = "VANITY_URL", /** Guild is verified */ - VERIFIED = "VERIFIED", + Verified = "VERIFIED", /** Guild is partnered */ - PARTNERED = "PARTNERED", + Partnered = "PARTNERED", /** Guild can enable welcome screen, Membership Screening, stage channels and discovery, and recives community updates */ - COMMUNITY = "COMMUNITY", + Community = "COMMUNITY", /** Guild has access to use commerce features (i.e. create store channels) */ - COMMERCE = "COMMERCE", + Commerce = "COMMERCE", /** Guild has access to create news channels */ - NEWS = "NEWS", + News = "NEWS", /** Guild is able to be discovered in the directory */ - DISCOVERABLE = "DISCOVERABLE", + Discoverable = "DISCOVERABLE", /** guild cannot be discoverable */ - DISCOVERABLE_DISABLED = "DISCOVERABLE_DISABLED", + DiscoverableDisabled = "DISCOVERABLE_DISABLED", /** Guild is able to be featured in the directory */ - FEATURABLE = "FEATURABLE", + Feature = "FEATURABLE", /** Guild has access to set an animated guild icon */ - ANIMATED_ICON = "ANIMATED_ICON", + AnimatedIcon = "ANIMATED_ICON", /** Guild has access to set a guild banner image */ - BANNER = "BANNER", + Banner = "BANNER", /** Guild has enabled the welcome screen */ - WELCOME_SCREEN_ENABLED = "WELCOME_SCREEN_ENABLED", + WelcomeScreenEnabled = "WELCOME_SCREEN_ENABLED", /** Guild has enabled [Membership Screening](https://discord.com/developers/docs/resources/guild#membership-screening-object) */ - MEMBER_VERIFICATION_GATE_ENABLED = "MEMBER_VERIFICATION_GATE_ENABLED", + MemberVerificationGateEnabled = "MEMBER_VERIFICATION_GATE_ENABLED", /** Guild can be previewed before joining via Membership Screening or the directory */ - PREVIEW_ENABLED = "PREVIEW_ENABLED", + PreviewEnabled = "PREVIEW_ENABLED", } export type GuildFeatures = DiscordGuildFeatures; diff --git a/src/types/guilds/mfa_levels.ts b/src/types/guilds/mfa_levels.ts index 12ef1ad7a..cb664b8ae 100644 --- a/src/types/guilds/mfa_levels.ts +++ b/src/types/guilds/mfa_levels.ts @@ -1,9 +1,9 @@ /** https://discord.com/developers/docs/resources/guild#guild-object-mfa-level */ export enum DiscordMfaLevels { /** Guild has no MFA/2FA requirement for moderation actions */ - NONE, + None, /** Guild has a 2FA requirement for moderation actions */ - ELEVATED, + Elevated, } export type MfaLevels = DiscordMfaLevels; diff --git a/src/types/guilds/premium_tiers.ts b/src/types/guilds/premium_tiers.ts index 755c87e00..f6df334ec 100644 --- a/src/types/guilds/premium_tiers.ts +++ b/src/types/guilds/premium_tiers.ts @@ -1,13 +1,13 @@ /** https://discord.com/developers/docs/resources/guild#guild-object-premium-tier */ export enum DiscordPremiumTiers { /** Guild has not unlocked any Server Boost perks */ - NONE, + None, /** Guild has unlocked Server Boost level 1 perks */ - TIER_1, + Tier1, /** Guild has unlocked Server Boost level 2 perks */ - TIER_2, + Tier2, /** Guild has unlocked Server Boost level 3 perks */ - TIER_3, + Tier3, } export type PremiumTiers = DiscordPremiumTiers; diff --git a/src/types/guilds/system_channel_flags.ts b/src/types/guilds/system_channel_flags.ts index a2aebd752..81a5e2e79 100644 --- a/src/types/guilds/system_channel_flags.ts +++ b/src/types/guilds/system_channel_flags.ts @@ -1,11 +1,11 @@ /** https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags */ export enum DiscordSystemChannelFlags { /** Suppress member join notifications */ - SUPPRESS_JOIN_NOTIFICATIONS = 1 << 0, + SuppressJoinNotifications = 1 << 0, /** Suppress server boost notifications */ - SUPPRESS_PREMIUM_SUBSCRIPTIONS = 1 << 1, + SuppressPremiumSubscriptions = 1 << 1, /** Suppress server setup tips */ - SUPPRESS_GUILD_REMINDER_NOTIFICATIONS = 1 << 2, + SuppressGuildReminderNotifications = 1 << 2, } export type SystemChannelFlags = DiscordSystemChannelFlags; diff --git a/src/types/guilds/verification_levels.ts b/src/types/guilds/verification_levels.ts index 5e4e5f98e..5afa2f4d8 100644 --- a/src/types/guilds/verification_levels.ts +++ b/src/types/guilds/verification_levels.ts @@ -1,15 +1,15 @@ /** https://discord.com/developers/docs/resources/guild#guild-object-verification-level */ export enum DiscordVerificationLevels { /** Unrestricted */ - NONE, + None, /** Must have verified email on account */ - LOW, + Low, /** Must be registered on Discord for longer than 5 minutes */ - MEDIUM, + Medium, /** Must be a member of the server for longer than 10 minutes */ - HIGH, + High, /** Must have a verified phone number */ - VERY_HIGH, + VeryHigh, } export type VerificationLevels = DiscordVerificationLevels; diff --git a/src/types/interactions/application_command_option_types.ts b/src/types/interactions/application_command_option_types.ts index da0f2ed76..efae7bf80 100644 --- a/src/types/interactions/application_command_option_types.ts +++ b/src/types/interactions/application_command_option_types.ts @@ -1,14 +1,14 @@ /** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptiontype */ export enum DiscordApplicationCommandOptionTypes { - SUB_COMMAND = 1, - SUB_COMMAND_GROUP, - STRING, - INTEGER, - BOOLEAN, - USER, - CHANNEL, - ROLE, - MENTIONABLE, + SubCommand = 1, + SubCommandGroup, + String, + Integer, + Boolean, + User, + Channel, + Role, + Mentionable, } export type ApplicationCommandOptionTypes = diff --git a/src/types/invites/target_types.ts b/src/types/invites/target_types.ts index c8f16d0ac..0d3153072 100644 --- a/src/types/invites/target_types.ts +++ b/src/types/invites/target_types.ts @@ -1,7 +1,7 @@ /** https://discord.com/developers/docs/resources/invite#invite-object-target-user-types */ export enum DiscordTargetTypes { - STREAM = 1, - EMBEDDED_APPLICATION, + Stream = 1, + EmbeddedApplication, } export type TargetTypes = DiscordTargetTypes; diff --git a/src/types/messages/message_activity_types.ts b/src/types/messages/message_activity_types.ts index 5340111b9..91944ae0f 100644 --- a/src/types/messages/message_activity_types.ts +++ b/src/types/messages/message_activity_types.ts @@ -1,9 +1,9 @@ /** https://discord.com/developers/docs/resources/channel#message-object-message-activity-types */ export enum DiscordMessageActivityTypes { - JOIN = 1, - SPECTATE, - LISTEN, - JOIN_REQUEST, + Join = 1, + Spectate, + Listen, + JoinRequest, } export type MessageActivityTypes = DiscordMessageActivityTypes; diff --git a/src/types/messages/message_sticker_format_types.ts b/src/types/messages/message_sticker_format_types.ts index 3a2baa629..7193cb245 100644 --- a/src/types/messages/message_sticker_format_types.ts +++ b/src/types/messages/message_sticker_format_types.ts @@ -1,8 +1,8 @@ /** https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types */ export enum DiscordMessageStickerFormatTypes { - PNG = 1, - APNG, - LOTTIE, + Png = 1, + Apng, + Lottie, } export type MessageStickerFormatTypes = DiscordMessageStickerFormatTypes; diff --git a/src/types/misc/activity_flags.ts b/src/types/misc/activity_flags.ts index 7b0abdd40..a51521231 100644 --- a/src/types/misc/activity_flags.ts +++ b/src/types/misc/activity_flags.ts @@ -1,11 +1,11 @@ /** https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags */ export enum DiscordActivityFlags { - INSTANCE = 1 << 0, - JOIN = 1 << 1, - SPECTATE = 1 << 2, - JOIN_REQUEST = 1 << 3, - SYNC = 1 << 4, - PLAY = 1 << 5, + Instance = 1 << 0, + Join = 1 << 1, + Spectate = 1 << 2, + JoinRequest = 1 << 3, + Sync = 1 << 4, + Play = 1 << 5, } export type ActivityFlags = DiscordActivityFlags; diff --git a/src/types/teams/team_membership_states.ts b/src/types/teams/team_membership_states.ts index 151fb4868..b1bc70c8d 100644 --- a/src/types/teams/team_membership_states.ts +++ b/src/types/teams/team_membership_states.ts @@ -1,7 +1,7 @@ /** https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum */ export enum DiscordTeamMembershipStates { - INVITED = 1, - ACCEPTED, + Invited = 1, + Accepted, } export type TeamMembershipStates = DiscordTeamMembershipStates; From aefd5c75f5488e8351a0df7fdb2c75becd2e9603 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 4 May 2021 21:05:43 +0200 Subject: [PATCH 02/15] fix changes --- src/handlers/channels/CHANNEL_DELETE.ts | 2 +- src/helpers/channels/clone_channel.ts | 2 +- src/helpers/channels/start_typing.ts | 2 +- src/helpers/members/fetch_members.ts | 2 +- src/helpers/members/get_members.ts | 2 +- src/helpers/messages/send_message.ts | 2 +- src/structures/guild.ts | 4 ++-- src/types/channels/channel_types.ts | 2 +- src/util/utils.ts | 8 ++++---- tests/channels/channel_overwrite_has_permission.ts | 2 +- tests/channels/clone_channel.ts | 2 +- tests/channels/create_channel.ts | 2 +- tests/channels/delete_channel_overwrite.ts | 2 +- tests/channels/edit_channel_overwrite.ts | 4 ++-- tests/channels/is_channel_synced.ts | 2 +- tests/ws/start_bot.ts | 9 ++++----- 16 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/handlers/channels/CHANNEL_DELETE.ts b/src/handlers/channels/CHANNEL_DELETE.ts index 511aae6c9..a2e07b828 100644 --- a/src/handlers/channels/CHANNEL_DELETE.ts +++ b/src/handlers/channels/CHANNEL_DELETE.ts @@ -37,7 +37,7 @@ export async function handleChannelDelete(data: DiscordGatewayPayload) { if ( [ DiscordChannelTypes.GuildText, - DiscordChannelTypes.Dm, + DiscordChannelTypes.DM, DiscordChannelTypes.GroupDm, DiscordChannelTypes.GuildNews, ].includes(payload.type) diff --git a/src/helpers/channels/clone_channel.ts b/src/helpers/channels/clone_channel.ts index 632fc770f..6a3696fac 100644 --- a/src/helpers/channels/clone_channel.ts +++ b/src/helpers/channels/clone_channel.ts @@ -14,7 +14,7 @@ export async function cloneChannel(channelId: bigint, reason?: string) { //Check for DM channel if ( - channelToClone.type === DiscordChannelTypes.Dm || + channelToClone.type === DiscordChannelTypes.DM || channelToClone.type === DiscordChannelTypes.GroupDm ) { throw new Error(Errors.CHANNEL_NOT_IN_GUILD); diff --git a/src/helpers/channels/start_typing.ts b/src/helpers/channels/start_typing.ts index 4f65aa771..8a48c8ccc 100644 --- a/src/helpers/channels/start_typing.ts +++ b/src/helpers/channels/start_typing.ts @@ -16,7 +16,7 @@ export async function startTyping(channelId: bigint) { if (channel) { if ( ![ - DiscordChannelTypes.Dm, + DiscordChannelTypes.DM, DiscordChannelTypes.GuildNews, DiscordChannelTypes.GuildText, DiscordChannelTypes.GuildNewsThread, diff --git a/src/helpers/members/fetch_members.ts b/src/helpers/members/fetch_members.ts index eca4c7720..2781bafa1 100644 --- a/src/helpers/members/fetch_members.ts +++ b/src/helpers/members/fetch_members.ts @@ -24,7 +24,7 @@ export function fetchMembers( // You can request 1 member without the intent if ( (!options?.limit || options.limit > 1) && - !(ws.identifyPayload.intents & DiscordGatewayIntents.GUILD_MEMBERS) + !(ws.identifyPayload.intents & DiscordGatewayIntents.GuildMembers) ) { throw new Error(Errors.MISSING_INTENT_GUILD_MEMBERS); } diff --git a/src/helpers/members/get_members.ts b/src/helpers/members/get_members.ts index 6a7c95dd4..2305d0cbc 100644 --- a/src/helpers/members/get_members.ts +++ b/src/helpers/members/get_members.ts @@ -24,7 +24,7 @@ export async function getMembers( guildId: bigint, options?: ListGuildMembers & { addToCache?: boolean }, ) { - if (!(ws.identifyPayload.intents && DiscordGatewayIntents.GUILD_MEMBERS)) { + if (!(ws.identifyPayload.intents && DiscordGatewayIntents.GuildMembers)) { throw new Error(Errors.MISSING_INTENT_GUILD_MEMBERS); } diff --git a/src/helpers/messages/send_message.ts b/src/helpers/messages/send_message.ts index ff80dfb53..4e1249b0c 100644 --- a/src/helpers/messages/send_message.ts +++ b/src/helpers/messages/send_message.ts @@ -26,7 +26,7 @@ export async function sendMessage( if (channel) { if ( ![ - DiscordChannelTypes.Dm, + DiscordChannelTypes.DM, DiscordChannelTypes.GuildNews, DiscordChannelTypes.GuildText, DiscordChannelTypes.GuildPublicThread, diff --git a/src/structures/guild.ts b/src/structures/guild.ts index e90f0f5b2..02da59f03 100644 --- a/src/structures/guild.ts +++ b/src/structures/guild.ts @@ -92,10 +92,10 @@ const baseGuild: Partial = { return cache.members.get(this.ownerId!); }, get partnered() { - return Boolean(this.features?.includes(DiscordGuildFeatures.PARTNERED)); + return Boolean(this.features?.includes(DiscordGuildFeatures.Partnered)); }, get verified() { - return Boolean(this.features?.includes(DiscordGuildFeatures.VERIFIED)); + return Boolean(this.features?.includes(DiscordGuildFeatures.Verified)); }, bannerURL(size, format) { return guildBannerURL(this.id!, this.banner!, size, format); diff --git a/src/types/channels/channel_types.ts b/src/types/channels/channel_types.ts index 26a3ce5e4..aec5aed04 100644 --- a/src/types/channels/channel_types.ts +++ b/src/types/channels/channel_types.ts @@ -3,7 +3,7 @@ export enum DiscordChannelTypes { /** A text channel within a server */ GuildText, /** A direct message between users */ - Dm, + DM, /** A voice channel within a server */ GuildVoice, /** A direct message between multiple users */ diff --git a/src/util/utils.ts b/src/util/utils.ts index c37bcb0fd..4b81719c6 100644 --- a/src/util/utils.ts +++ b/src/util/utils.ts @@ -130,11 +130,11 @@ function validateSlashOptionChoices( } if ( - (optionType === DiscordApplicationCommandOptionTypes.STRING && + (optionType === DiscordApplicationCommandOptionTypes.String && (typeof choice.value !== "string" || choice.value.length < 1 || choice.value.length > 100)) || - (optionType === DiscordApplicationCommandOptionTypes.INTEGER && + (optionType === DiscordApplicationCommandOptionTypes.Integer && typeof choice.value !== "number") ) { throw new Error(Errors.INVALID_SLASH_OPTIONS_CHOICES); @@ -152,8 +152,8 @@ function validateSlashOptions(options: ApplicationCommandOption[]) { if ( option.choices?.length && (option.choices.length > 25 || - (option.type !== DiscordApplicationCommandOptionTypes.STRING && - option.type !== DiscordApplicationCommandOptionTypes.INTEGER)) + (option.type !== DiscordApplicationCommandOptionTypes.String && + option.type !== DiscordApplicationCommandOptionTypes.Integer)) ) { throw new Error(Errors.INVALID_SLASH_OPTIONS_CHOICES); } diff --git a/tests/channels/channel_overwrite_has_permission.ts b/tests/channels/channel_overwrite_has_permission.ts index 71d3402b3..ff84e4add 100644 --- a/tests/channels/channel_overwrite_has_permission.ts +++ b/tests/channels/channel_overwrite_has_permission.ts @@ -53,7 +53,7 @@ Deno.test({ permissionOverwrites: [ { id: bigintToSnowflake(botId), - type: DiscordOverwriteTypes.MEMBER, + type: DiscordOverwriteTypes.Member, allow: ["VIEW_CHANNEL"], deny: [], }, diff --git a/tests/channels/clone_channel.ts b/tests/channels/clone_channel.ts index 4b526da61..9838a7698 100644 --- a/tests/channels/clone_channel.ts +++ b/tests/channels/clone_channel.ts @@ -141,7 +141,7 @@ Deno.test({ permissionOverwrites: [ { id: bigintToSnowflake(botId), - type: DiscordOverwriteTypes.MEMBER, + type: DiscordOverwriteTypes.Member, allow: ["VIEW_CHANNEL"], deny: [], }, diff --git a/tests/channels/create_channel.ts b/tests/channels/create_channel.ts index fbc85d1d5..63b44ec7e 100644 --- a/tests/channels/create_channel.ts +++ b/tests/channels/create_channel.ts @@ -160,7 +160,7 @@ Deno.test({ permissionOverwrites: [ { id: bigintToSnowflake(botId), - type: DiscordOverwriteTypes.MEMBER, + type: DiscordOverwriteTypes.Member, allow: ["VIEW_CHANNEL"], deny: [], }, diff --git a/tests/channels/delete_channel_overwrite.ts b/tests/channels/delete_channel_overwrite.ts index fc033dff3..d5337c631 100644 --- a/tests/channels/delete_channel_overwrite.ts +++ b/tests/channels/delete_channel_overwrite.ts @@ -56,7 +56,7 @@ Deno.test({ permissionOverwrites: [ { id: bigintToSnowflake(botId), - type: DiscordOverwriteTypes.MEMBER, + type: DiscordOverwriteTypes.Member, allow: ["VIEW_CHANNEL"], deny: [], }, diff --git a/tests/channels/edit_channel_overwrite.ts b/tests/channels/edit_channel_overwrite.ts index b1482b4f5..e74c244cd 100644 --- a/tests/channels/edit_channel_overwrite.ts +++ b/tests/channels/edit_channel_overwrite.ts @@ -35,7 +35,7 @@ async function ifItFailsBlameWolf(options: CreateGuildChannel) { } await editChannelOverwrite(channel.guildId, channel.id, botId, { - type: DiscordOverwriteTypes.MEMBER, + type: DiscordOverwriteTypes.Member, allow: ["VIEW_CHANNEL", "ADD_REACTIONS"], deny: [], }); @@ -71,7 +71,7 @@ Deno.test({ permissionOverwrites: [ { id: bigintToSnowflake(botId), - type: DiscordOverwriteTypes.MEMBER, + type: DiscordOverwriteTypes.Member, allow: ["VIEW_CHANNEL"], deny: [], }, diff --git a/tests/channels/is_channel_synced.ts b/tests/channels/is_channel_synced.ts index c341b3374..6a4d96db7 100644 --- a/tests/channels/is_channel_synced.ts +++ b/tests/channels/is_channel_synced.ts @@ -18,7 +18,7 @@ Deno.test({ permissionOverwrites: [ { id: bigintToSnowflake(botId), - type: DiscordOverwriteTypes.MEMBER, + type: DiscordOverwriteTypes.Member, allow: ["VIEW_CHANNEL"], deny: [], }, diff --git a/tests/ws/start_bot.ts b/tests/ws/start_bot.ts index a68b2d0fc..266da17e9 100644 --- a/tests/ws/start_bot.ts +++ b/tests/ws/start_bot.ts @@ -36,11 +36,10 @@ Deno.test({ await startBot({ token, intents: [ - "GUILD_MESSAGES", - "GUILDS", - "GUILD_EMOJIS", - "GUILD_MESSAGE_REACTIONS", - "GUILD_EMOJIS", + "GuildMessages", + "Guilds", + "GuildEmojis", + "GuildMessageReactions", ], }); From ff1eb2e6f2db4524b8fec75d9371626cb21d1135 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 4 May 2021 22:04:01 +0200 Subject: [PATCH 03/15] add: getWebhookMessage --- src/helpers/webhooks/get_webhook_message.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/helpers/webhooks/get_webhook_message.ts diff --git a/src/helpers/webhooks/get_webhook_message.ts b/src/helpers/webhooks/get_webhook_message.ts new file mode 100644 index 000000000..eddee7609 --- /dev/null +++ b/src/helpers/webhooks/get_webhook_message.ts @@ -0,0 +1,18 @@ +import { rest } from "../../rest/rest.ts"; +import { structures } from "../../structures/mod.ts"; +import { Message } from "../../types/messages/message.ts"; +import { endpoints } from "../../util/constants.ts"; + +/** Returns a previousy-sent webhook message from the same token. Returns a message object on success. */ +export async function getWebhookMessage( + webhookId: bigint, + webhookToken: string, + messageId: bigint, +) { + const result = await rest.runMethod( + "get", + endpoints.WEBHOOK_MESSAGE(webhookId, webhookToken, messageId), + ); + + return await structures.createDiscordenoMessage(result); +} From dd8baf93f5672b754809566d72a4723e21d85f6c Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 4 May 2021 22:06:32 +0200 Subject: [PATCH 04/15] add: getOriginalinteractionResponse --- .../commands/get_original_interaction_response.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/helpers/commands/get_original_interaction_response.ts diff --git a/src/helpers/commands/get_original_interaction_response.ts b/src/helpers/commands/get_original_interaction_response.ts new file mode 100644 index 000000000..b6009c94f --- /dev/null +++ b/src/helpers/commands/get_original_interaction_response.ts @@ -0,0 +1,15 @@ +import { applicationId } from "../../bot.ts"; +import { rest } from "../../rest/rest.ts"; +import { structures } from "../../structures/mod.ts"; +import type { Message } from "../../types/messages/message.ts"; +import { endpoints } from "../../util/constants.ts"; + +/** Returns the initial Interactio response. Functions the same as Get Webhook Message */ +export async function getOriginalInteractionResponse(token: string) { + const result = await rest.runMethod( + "get", + endpoints.INTERACTION_ORIGINAL_ID_TOKEN(applicationId, token), + ); + + return await structures.createDiscordenoMessage(result); +} From 38b8ea5532f5995b969f92e4a2ee6f7ca11820cf Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 4 May 2021 22:06:40 +0200 Subject: [PATCH 05/15] fix: imports use type --- src/helpers/webhooks/get_webhook_message.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/webhooks/get_webhook_message.ts b/src/helpers/webhooks/get_webhook_message.ts index eddee7609..d59fc02a7 100644 --- a/src/helpers/webhooks/get_webhook_message.ts +++ b/src/helpers/webhooks/get_webhook_message.ts @@ -1,6 +1,6 @@ import { rest } from "../../rest/rest.ts"; import { structures } from "../../structures/mod.ts"; -import { Message } from "../../types/messages/message.ts"; +import type { Message } from "../../types/messages/message.ts"; import { endpoints } from "../../util/constants.ts"; /** Returns a previousy-sent webhook message from the same token. Returns a message object on success. */ From 09d6177b5fa2e3979ee67df1d4536e21750b5340 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 4 May 2021 22:07:43 +0200 Subject: [PATCH 06/15] add: new handlers mod export --- src/helpers/mod.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/helpers/mod.ts b/src/helpers/mod.ts index 6d0aea748..903614119 100644 --- a/src/helpers/mod.ts +++ b/src/helpers/mod.ts @@ -19,6 +19,7 @@ import { deleteSlashCommand } from "./commands/delete_slash_command.ts"; import { deleteSlashResponse } from "./commands/delete_slash_response.ts"; import { editSlashCommandPermissions } from "./commands/edit_slash_command_permissions.ts"; import { editSlashResponse } from "./commands/edit_slash_response.ts"; +import { getOriginalInteractionResponse } from "./commands/get_original_interaction_response.ts"; import { getSlashCommand } from "./commands/get_slash_command.ts"; import { getSlashCommands } from "./commands/get_slash_commands.ts"; import { getSlashCommandPermission } from "./commands/get_slash_command_permission.ts"; @@ -111,6 +112,9 @@ import { editGuildTemplate } from "./templates/edit_guild_template.ts"; import { getGuildTemplates } from "./templates/get_guild_templates.ts"; import { getTemplate } from "./templates/get_template.ts"; import { syncGuildTemplate } from "./templates/sync_guild_template.ts"; +// Type Guards +import { isActionRow } from "./type_guards/is_action_row.ts"; +import { isButton } from "./type_guards/is_button.ts"; import { createWebhook } from "./webhooks/create_webhook.ts"; import { deleteWebhook } from "./webhooks/delete_webhook.ts"; import { deleteWebhookMessage } from "./webhooks/delete_webhook_message.ts"; @@ -118,13 +122,11 @@ import { deleteWebhookWithToken } from "./webhooks/delete_webhook_with_token.ts" import { editWebhook } from "./webhooks/edit_webhook.ts"; import { editWebhookMessage } from "./webhooks/edit_webhook_message.ts"; import { editWebhookWithToken } from "./webhooks/edit_webhook_with_token.ts"; -import { sendWebhook } from "./webhooks/send_webhook.ts"; import { getWebhook } from "./webhooks/get_webhook.ts"; import { getWebhooks } from "./webhooks/get_webhooks.ts"; +import { getWebhookMessage } from "./webhooks/get_webhook_message.ts"; import { getWebhookWithToken } from "./webhooks/get_webhook_with_token.ts"; -// Type Guards -import { isActionRow } from "./type_guards/is_action_row.ts"; -import { isButton } from "./type_guards/is_button.ts"; +import { sendWebhook } from "./webhooks/send_webhook.ts"; export { addDiscoverySubcategory, @@ -205,6 +207,7 @@ export { getMembers, getMessage, getMessages, + getOriginalInteractionResponse, getPins, getPruneCount, getReactions, @@ -218,6 +221,7 @@ export { getVanityURL, getVoiceRegions, getWebhook, + getWebhookMessage, getWebhooks, getWebhookWithToken, getWelcomeScreen, @@ -289,6 +293,7 @@ export let helpers = { getSlashCommands, upsertSlashCommand, upsertSlashCommands, + getOriginalInteractionResponse, // emojis createEmoji, deleteEmoji, @@ -396,6 +401,7 @@ export let helpers = { getWebhookWithToken, getWebhook, getWebhooks, + getWebhookMessage, }; export type Helpers = typeof helpers; From b0ea2549ad42ba0b13017c1976f158972f7c8052 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 4 May 2021 22:12:04 +0200 Subject: [PATCH 07/15] getinvites add options --- src/helpers/invites/get_invite.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/helpers/invites/get_invite.ts b/src/helpers/invites/get_invite.ts index f0781e927..12772f327 100644 --- a/src/helpers/invites/get_invite.ts +++ b/src/helpers/invites/get_invite.ts @@ -1,11 +1,14 @@ import { rest } from "../../rest/rest.ts"; +import { GetInvite } from "../../types/invites/get_invite.ts"; import type { Invite } from "../../types/invites/invite.ts"; import { endpoints } from "../../util/constants.ts"; +import { camelKeysToSnakeCase } from "../../util/utils.ts"; /** Returns an invite for the given code or throws an error if the invite doesn't exists. */ -export async function getInvite(inviteCode: string) { +export async function getInvite(inviteCode: string, options: GetInvite) { return await rest.runMethod( "get", endpoints.INVITE(inviteCode), + camelKeysToSnakeCase(options), ); } From 2d25f275a9cfc94f01fd62d02a8f0b0e405291bc Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 4 May 2021 22:20:14 +0200 Subject: [PATCH 08/15] nonce has been removed --- src/types/messages/create_message.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/types/messages/create_message.ts b/src/types/messages/create_message.ts index fa1704f90..c59ef410f 100644 --- a/src/types/messages/create_message.ts +++ b/src/types/messages/create_message.ts @@ -8,13 +8,11 @@ import { MessageComponents } from "./components/message_components.ts"; export interface CreateMessage { /** The message contents (up to 2000 characters) */ content?: string; - /** A nonce that can be used for optimistic message sending */ - nonce?: number | string; /** true if this is a TTS message */ tts?: boolean; /** Embedded `rich` content */ embed?: Embed; - /** Allowed mentions for a message */ + /** Allowed mentions for the message */ allowedMentions?: AllowedMentions; /** Include to make your message a reply */ messageReference?: MessageReference; From 3694c377ebdb641cbf8d76e13af8c94c639a00a2 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 4 May 2021 22:20:36 +0200 Subject: [PATCH 09/15] Update send_message.ts --- src/helpers/messages/send_message.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/helpers/messages/send_message.ts b/src/helpers/messages/send_message.ts index ff80dfb53..7e5b815dd 100644 --- a/src/helpers/messages/send_message.ts +++ b/src/helpers/messages/send_message.ts @@ -145,13 +145,6 @@ export async function sendMessage( } } - if ( - content.nonce && - !validateLength(content.nonce.toString(), { max: 25 }) - ) { - throw new Error(Errors.NONCE_TOO_LONG); - } - const result = await rest.runMethod( "post", endpoints.CHANNEL_MESSAGES(channelId), From 3ecfaef780358b9e93fec53a498840e04c5df653 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 4 May 2021 22:22:41 +0200 Subject: [PATCH 10/15] edit message can now have files --- src/types/messages/edit_message.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/types/messages/edit_message.ts b/src/types/messages/edit_message.ts index 41169bc55..0ca2f06d9 100644 --- a/src/types/messages/edit_message.ts +++ b/src/types/messages/edit_message.ts @@ -1,4 +1,5 @@ import { Embed } from "../embeds/embed.ts"; +import { FileContent } from "../misc/file_content.ts"; import { AllowedMentions } from "./allowed_mentions.ts"; import { Attachment } from "./attachment.ts"; @@ -10,6 +11,8 @@ export interface EditMessage { embed?: Embed | null; /** Edit the flags of the message (only `SUPRESS_EMBEDS` can currently be set/unset) */ flags?: 4 | null; + /** The contents of the file being sent/edited */ + file?: FileContent | FileContent[] | null; /** Allowed mentions for the message */ allowedMentions?: AllowedMentions | null; /** Attached files to keep */ From 147453cd1e7f155946a0910a8201b1389968ad0b Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 4 May 2021 22:22:53 +0200 Subject: [PATCH 11/15] fix files can be nullable --- src/types/webhooks/edit_webhook_message.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types/webhooks/edit_webhook_message.ts b/src/types/webhooks/edit_webhook_message.ts index 6317c70fe..d8fc7ba3c 100644 --- a/src/types/webhooks/edit_webhook_message.ts +++ b/src/types/webhooks/edit_webhook_message.ts @@ -1,7 +1,7 @@ import { Embed } from "../embeds/embed.ts"; import { AllowedMentions } from "../messages/allowed_mentions.ts"; -import { FileContent } from "../misc/file_content.ts"; import { Attachment } from "../messages/attachment.ts"; +import { FileContent } from "../misc/file_content.ts"; /** https://discord.com/developers/docs/resources/webhook#edit-webhook-message-jsonform-params */ export interface EditWebhookMessage { @@ -10,7 +10,7 @@ export interface EditWebhookMessage { /** Embedded `rich` content */ embeds?: Embed[] | null; /** The contents of the file being sent/edited */ - file?: FileContent | FileContent[]; + file?: FileContent | FileContent[] | null; /** Allowed mentions for the message */ allowedMentions?: AllowedMentions | null; /** Attached files to keep */ From c5cf4ba3533734aa3b485ee6d8737e3fcc30cf40 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 4 May 2021 22:24:37 +0200 Subject: [PATCH 12/15] Update get_invite.ts --- src/helpers/invites/get_invite.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers/invites/get_invite.ts b/src/helpers/invites/get_invite.ts index 12772f327..8e5b177e4 100644 --- a/src/helpers/invites/get_invite.ts +++ b/src/helpers/invites/get_invite.ts @@ -5,10 +5,10 @@ import { endpoints } from "../../util/constants.ts"; import { camelKeysToSnakeCase } from "../../util/utils.ts"; /** Returns an invite for the given code or throws an error if the invite doesn't exists. */ -export async function getInvite(inviteCode: string, options: GetInvite) { +export async function getInvite(inviteCode: string, options?: GetInvite) { return await rest.runMethod( "get", endpoints.INVITE(inviteCode), - camelKeysToSnakeCase(options), + camelKeysToSnakeCase(options ?? {}), ); } From d16280512cbdfa0179f3df8fc8bc9081c6056e4f Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 4 May 2021 22:36:00 +0200 Subject: [PATCH 13/15] add: webhook thread support --- src/helpers/webhooks/send_webhook.ts | 6 +++--- src/types/webhooks/execute_webhook.ts | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/helpers/webhooks/send_webhook.ts b/src/helpers/webhooks/send_webhook.ts index e627e485a..20cd92e46 100644 --- a/src/helpers/webhooks/send_webhook.ts +++ b/src/helpers/webhooks/send_webhook.ts @@ -66,9 +66,9 @@ export async function sendWebhook( const result = await rest.runMethod( "post", - `${endpoints.WEBHOOK(webhookId, webhookToken)}${ - options.wait ? "?wait=true" : "" - }`, + `${endpoints.WEBHOOK(webhookId, webhookToken)}?wait=${ + options.wait ? "true" : "false" + }${options.threadId ? `&thread_id=${options.threadId}` : ""}`, { ...options, allowed_mentions: options.allowedMentions, diff --git a/src/types/webhooks/execute_webhook.ts b/src/types/webhooks/execute_webhook.ts index 9268f21bf..bce114c30 100644 --- a/src/types/webhooks/execute_webhook.ts +++ b/src/types/webhooks/execute_webhook.ts @@ -7,6 +7,8 @@ import { SnakeCasedPropertiesDeep } from "../util.ts"; export interface ExecuteWebhook { /** Waits for server confirmation of message send before response, and returns the created message body (defaults to `false`; when `false` a message that is not saved does not return an error) */ wait?: boolean; + /** Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived. */ + threadId?: bigint; /** The message contents (up to 2000 characters) */ content?: string; /** Override the default username of the webhook */ From 774d7649f5bc78c43eb1714325a8f6fe1e742070 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Wed, 5 May 2021 15:54:41 +0200 Subject: [PATCH 14/15] Update send_webhook.ts --- src/helpers/webhooks/send_webhook.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/helpers/webhooks/send_webhook.ts b/src/helpers/webhooks/send_webhook.ts index 20cd92e46..cb90615ed 100644 --- a/src/helpers/webhooks/send_webhook.ts +++ b/src/helpers/webhooks/send_webhook.ts @@ -66,9 +66,9 @@ export async function sendWebhook( const result = await rest.runMethod( "post", - `${endpoints.WEBHOOK(webhookId, webhookToken)}?wait=${ - options.wait ? "true" : "false" - }${options.threadId ? `&thread_id=${options.threadId}` : ""}`, + `${endpoints.WEBHOOK(webhookId, webhookToken)}?wait=${options.wait}${ + options.threadId ? `&thread_id=${options.threadId}` : "" + }`, { ...options, allowed_mentions: options.allowedMentions, From 8e870ec637804a12698004328cb388e04d28c3ef Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Wed, 5 May 2021 18:03:34 +0200 Subject: [PATCH 15/15] fix the new test --- tests/util/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/util/utils.ts b/tests/util/utils.ts index 128d602a2..4cf2ef05e 100644 --- a/tests/util/utils.ts +++ b/tests/util/utils.ts @@ -114,7 +114,7 @@ Deno.test({ const option = { name: "option1", description: "The description of the application command's option.", - type: DiscordApplicationCommandOptionTypes.STRING, + type: DiscordApplicationCommandOptionTypes.String, }; // The maximum number of options an application command can "accomodate" is 25. const options: ApplicationCommandOption[] = Array(26).fill(option);