diff --git a/helpers/channels/createChannel.ts b/helpers/channels/createChannel.ts index 523f65204..7d9473fb9 100644 --- a/helpers/channels/createChannel.ts +++ b/helpers/channels/createChannel.ts @@ -10,7 +10,7 @@ export async function createChannel(bot: Bot, guildId: bigint, options?: CreateG const result = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.GUILD_CHANNELS(guildId), options ? { diff --git a/helpers/channels/createStageInstance.ts b/helpers/channels/createStageInstance.ts index c4deb1768..45a284461 100644 --- a/helpers/channels/createStageInstance.ts +++ b/helpers/channels/createStageInstance.ts @@ -5,7 +5,7 @@ import { DiscordStageInstance } from "../../types/discord.ts"; export async function createStageInstance(bot: Bot, options: CreateStageInstance) { const result = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.STAGE_INSTANCES(), { channel_id: options.channelId.toString(), diff --git a/helpers/channels/deleteChannel.ts b/helpers/channels/deleteChannel.ts index c2e7e16b5..e10bf6acc 100644 --- a/helpers/channels/deleteChannel.ts +++ b/helpers/channels/deleteChannel.ts @@ -5,7 +5,7 @@ import { DiscordChannel } from "../../types/discord.ts"; export async function deleteChannel(bot: Bot, channelId: bigint, reason?: string) { await bot.rest.runMethod( bot.rest, - "delete", + "DELETE", bot.constants.routes.CHANNEL(channelId), { reason, diff --git a/helpers/channels/deleteChannelOverwrite.ts b/helpers/channels/deleteChannelOverwrite.ts index 0c8e85425..2d475b61f 100644 --- a/helpers/channels/deleteChannelOverwrite.ts +++ b/helpers/channels/deleteChannelOverwrite.ts @@ -4,7 +4,7 @@ import type { Bot } from "../../bot.ts"; export async function deleteChannelOverwrite(bot: Bot, channelId: bigint, overwriteId: bigint) { await bot.rest.runMethod( bot.rest, - "delete", + "DELETE", bot.constants.routes.CHANNEL_OVERWRITE(channelId, overwriteId), ); } diff --git a/helpers/channels/deleteStageInstance.ts b/helpers/channels/deleteStageInstance.ts index 8e9faad64..8ba1e502a 100644 --- a/helpers/channels/deleteStageInstance.ts +++ b/helpers/channels/deleteStageInstance.ts @@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts"; /** Deletes the Stage instance. Requires the user to be a moderator of the Stage channel. */ export async function deleteStageInstance(bot: Bot, channelId: bigint) { - await bot.rest.runMethod(bot.rest, "delete", bot.constants.routes.STAGE_INSTANCE(channelId)); + await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.STAGE_INSTANCE(channelId)); } diff --git a/helpers/channels/editChannel.ts b/helpers/channels/editChannel.ts index b611450e5..f70f780a6 100644 --- a/helpers/channels/editChannel.ts +++ b/helpers/channels/editChannel.ts @@ -34,7 +34,7 @@ export async function editChannel(bot: Bot, channelId: bigint, options: ModifyCh const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.CHANNEL(channelId), { name: options.name, diff --git a/helpers/channels/editChannelOverwrite.ts b/helpers/channels/editChannelOverwrite.ts index 53f44167f..c5cd60190 100644 --- a/helpers/channels/editChannelOverwrite.ts +++ b/helpers/channels/editChannelOverwrite.ts @@ -9,7 +9,7 @@ export async function editChannelOverwrite( ) { await bot.rest.runMethod( bot.rest, - "put", + "PUT", bot.constants.routes.CHANNEL_OVERWRITE(channelId, overwrite.id), { allow: overwrite.allow ? bot.utils.calculateBits(overwrite.allow) : "0", diff --git a/helpers/channels/followChannel.ts b/helpers/channels/followChannel.ts index 00973e135..d469a89f7 100644 --- a/helpers/channels/followChannel.ts +++ b/helpers/channels/followChannel.ts @@ -5,7 +5,7 @@ import { DiscordFollowedChannel } from "../../types/discord.ts"; export async function followChannel(bot: Bot, sourceChannelId: bigint, targetChannelId: bigint) { const data = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.CHANNEL_FOLLOW(sourceChannelId), { webhook_channel_id: targetChannelId, diff --git a/helpers/channels/forums/createForumPost.ts b/helpers/channels/forums/createForumPost.ts index a2bd9fe8d..0bafd8110 100644 --- a/helpers/channels/forums/createForumPost.ts +++ b/helpers/channels/forums/createForumPost.ts @@ -11,7 +11,7 @@ export async function createForumPost( ) { const result = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.FORUM_START(channelId), { name: options.name, diff --git a/helpers/channels/getChannel.ts b/helpers/channels/getChannel.ts index 76d50c821..905f53f0f 100644 --- a/helpers/channels/getChannel.ts +++ b/helpers/channels/getChannel.ts @@ -5,7 +5,7 @@ import { DiscordChannel } from "../../types/discord.ts"; export async function getChannel(bot: Bot, channelId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.CHANNEL(channelId), ); diff --git a/helpers/channels/getChannelWebhooks.ts b/helpers/channels/getChannelWebhooks.ts index 5997f4e3b..961c40f8a 100644 --- a/helpers/channels/getChannelWebhooks.ts +++ b/helpers/channels/getChannelWebhooks.ts @@ -6,7 +6,7 @@ import { DiscordWebhook } from "../../types/discord.ts"; export async function getChannelWebhooks(bot: Bot, channelId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.CHANNEL_WEBHOOKS(channelId), ); diff --git a/helpers/channels/getChannels.ts b/helpers/channels/getChannels.ts index e1d0ee226..c75419631 100644 --- a/helpers/channels/getChannels.ts +++ b/helpers/channels/getChannels.ts @@ -6,7 +6,7 @@ import { DiscordChannel } from "../../types/discord.ts"; export async function getChannels(bot: Bot, guildId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_CHANNELS(guildId), ); diff --git a/helpers/channels/getPins.ts b/helpers/channels/getPins.ts index d42e3fbee..3da7a30cb 100644 --- a/helpers/channels/getPins.ts +++ b/helpers/channels/getPins.ts @@ -5,7 +5,7 @@ import { DiscordMessage } from "../../types/discord.ts"; export async function getPins(bot: Bot, channelId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.CHANNEL_PINS(channelId), ); diff --git a/helpers/channels/getStageInstance.ts b/helpers/channels/getStageInstance.ts index ef98d1f93..d2f6ae5af 100644 --- a/helpers/channels/getStageInstance.ts +++ b/helpers/channels/getStageInstance.ts @@ -5,7 +5,7 @@ import { DiscordStageInstance } from "../../types/discord.ts"; export async function getStageInstance(bot: Bot, channelId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.STAGE_INSTANCE(channelId), ); diff --git a/helpers/channels/startTyping.ts b/helpers/channels/startTyping.ts index 5357e6099..75bc313e1 100644 --- a/helpers/channels/startTyping.ts +++ b/helpers/channels/startTyping.ts @@ -6,5 +6,5 @@ import type { Bot } from "../../bot.ts"; * this endpoint may be called to let the user know that the bot is processing their message. */ export async function startTyping(bot: Bot, channelId: bigint) { - await bot.rest.runMethod(bot.rest, "post", bot.constants.routes.CHANNEL_TYPING(channelId)); + await bot.rest.runMethod(bot.rest, "POST", bot.constants.routes.CHANNEL_TYPING(channelId)); } diff --git a/helpers/channels/swapChannels.ts b/helpers/channels/swapChannels.ts index c6819fb98..a9feef7d8 100644 --- a/helpers/channels/swapChannels.ts +++ b/helpers/channels/swapChannels.ts @@ -8,7 +8,7 @@ export async function swapChannels(bot: Bot, guildId: bigint, channelPositions: await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.GUILD_CHANNELS(guildId), channelPositions.map((channelPosition) => { return { diff --git a/helpers/channels/threads/addToThread.ts b/helpers/channels/threads/addToThread.ts index e5c3ca7bb..068159fdd 100644 --- a/helpers/channels/threads/addToThread.ts +++ b/helpers/channels/threads/addToThread.ts @@ -2,5 +2,5 @@ import type { Bot } from "../../../bot.ts"; /** Adds a user to a thread. Requires the ability to send messages in the thread. Requires the thread is not archived. */ export async function addToThread(bot: Bot, threadId: bigint, userId: bigint) { - await bot.rest.runMethod(bot.rest, "put", bot.constants.routes.THREAD_USER(threadId, userId)); + await bot.rest.runMethod(bot.rest, "PUT", bot.constants.routes.THREAD_USER(threadId, userId)); } diff --git a/helpers/channels/threads/getActiveThreads.ts b/helpers/channels/threads/getActiveThreads.ts index 5dfb9aa28..aa4a9dd20 100644 --- a/helpers/channels/threads/getActiveThreads.ts +++ b/helpers/channels/threads/getActiveThreads.ts @@ -6,7 +6,7 @@ import { Collection } from "../../../util/collection.ts"; export async function getActiveThreads(bot: Bot, guildId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.THREAD_ACTIVE(guildId), ); diff --git a/helpers/channels/threads/getArchivedThreads.ts b/helpers/channels/threads/getArchivedThreads.ts index 84176a835..1c542a71b 100644 --- a/helpers/channels/threads/getArchivedThreads.ts +++ b/helpers/channels/threads/getArchivedThreads.ts @@ -18,7 +18,7 @@ export async function getArchivedThreads( const result = (await bot.rest.runMethod( bot.rest, - "get", + "GET", url, )); diff --git a/helpers/channels/threads/getThreadMember.ts b/helpers/channels/threads/getThreadMember.ts index 3b73cedd5..091b8db9d 100644 --- a/helpers/channels/threads/getThreadMember.ts +++ b/helpers/channels/threads/getThreadMember.ts @@ -5,7 +5,7 @@ import { DiscordThreadMember } from "../../../types/discord.ts"; export async function getThreadMember(bot: Bot, threadId: bigint, userId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.THREAD_USER(threadId, userId), ); diff --git a/helpers/channels/threads/getThreadMembers.ts b/helpers/channels/threads/getThreadMembers.ts index 6d7369787..efd84fbb8 100644 --- a/helpers/channels/threads/getThreadMembers.ts +++ b/helpers/channels/threads/getThreadMembers.ts @@ -6,7 +6,7 @@ import { Collection } from "../../../util/collection.ts"; export async function getThreadMembers(bot: Bot, threadId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.THREAD_MEMBERS(threadId), ); // return result; diff --git a/helpers/channels/threads/joinThread.ts b/helpers/channels/threads/joinThread.ts index 7a51873af..785444196 100644 --- a/helpers/channels/threads/joinThread.ts +++ b/helpers/channels/threads/joinThread.ts @@ -2,5 +2,5 @@ import type { Bot } from "../../../bot.ts"; /** Adds the bot to the thread. Cannot join an archived thread. */ export async function joinThread(bot: Bot, threadId: bigint) { - await bot.rest.runMethod(bot.rest, "put", bot.constants.routes.THREAD_ME(threadId)); + await bot.rest.runMethod(bot.rest, "PUT", bot.constants.routes.THREAD_ME(threadId)); } diff --git a/helpers/channels/threads/leaveThread.ts b/helpers/channels/threads/leaveThread.ts index 8a6f57758..f4ed15f6a 100644 --- a/helpers/channels/threads/leaveThread.ts +++ b/helpers/channels/threads/leaveThread.ts @@ -2,5 +2,5 @@ import type { Bot } from "../../../bot.ts"; /** Removes the bot from a thread. Requires the thread is not archived. */ export async function leaveThread(bot: Bot, threadId: bigint) { - await bot.rest.runMethod(bot.rest, "delete", bot.constants.routes.THREAD_ME(threadId)); + await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.THREAD_ME(threadId)); } diff --git a/helpers/channels/threads/removeThreadMember.ts b/helpers/channels/threads/removeThreadMember.ts index e2d14868e..7359a9cb9 100644 --- a/helpers/channels/threads/removeThreadMember.ts +++ b/helpers/channels/threads/removeThreadMember.ts @@ -2,5 +2,5 @@ import type { Bot } from "../../../bot.ts"; /** Removes a user from a thread. Requires the MANAGE_THREADS permission or that you are the creator of the thread. Also requires the thread is not archived. */ export async function removeThreadMember(bot: Bot, threadId: bigint, userId: bigint) { - await bot.rest.runMethod(bot.rest, "delete", bot.constants.routes.THREAD_USER(threadId, userId)); + await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.THREAD_USER(threadId, userId)); } diff --git a/helpers/channels/threads/startThreadWithMessage.ts b/helpers/channels/threads/startThreadWithMessage.ts index baee4b936..7dcaf52e2 100644 --- a/helpers/channels/threads/startThreadWithMessage.ts +++ b/helpers/channels/threads/startThreadWithMessage.ts @@ -10,7 +10,7 @@ export async function startThreadWithMessage( ) { const result = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.THREAD_START_PUBLIC(channelId, messageId), { name: options.name, diff --git a/helpers/channels/threads/startThreadWithoutMessage.ts b/helpers/channels/threads/startThreadWithoutMessage.ts index 53d3b2576..4b54a6888 100644 --- a/helpers/channels/threads/startThreadWithoutMessage.ts +++ b/helpers/channels/threads/startThreadWithoutMessage.ts @@ -6,7 +6,7 @@ import { ChannelTypes } from "../../../types/shared.ts"; export async function startThreadWithoutMessage(bot: Bot, channelId: bigint, options: StartThreadWithoutMessage) { const result = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.THREAD_START_PRIVATE(channelId), { name: options.name, diff --git a/helpers/channels/updateStageInstance.ts b/helpers/channels/updateStageInstance.ts index 4ad25d3b1..e283ef192 100644 --- a/helpers/channels/updateStageInstance.ts +++ b/helpers/channels/updateStageInstance.ts @@ -10,7 +10,7 @@ export async function updateStageInstance( ) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.STAGE_INSTANCE(channelId), { topic: data.topic, diff --git a/helpers/channels/updateVoiceState.ts b/helpers/channels/updateVoiceState.ts index ded3eb8ea..01f952473 100644 --- a/helpers/channels/updateVoiceState.ts +++ b/helpers/channels/updateVoiceState.ts @@ -11,7 +11,7 @@ import type { Bot } from "../../bot.ts"; * - When suppressed, the user will have their `request_to_speak_timestamp` removed. */ export async function updateBotVoiceState(bot: Bot, guildId: bigint, options: UpdateSelfVoiceState) { - await bot.rest.runMethod(bot.rest, "patch", bot.constants.routes.UPDATE_VOICE_STATE(guildId), { + await bot.rest.runMethod(bot.rest, "PATCH", bot.constants.routes.UPDATE_VOICE_STATE(guildId), { channel_id: options.channelId, suppress: options.suppress, request_to_speak_timestamp: options.requestToSpeakTimestamp @@ -34,7 +34,7 @@ export async function updateBotVoiceState(bot: Bot, guildId: bigint, options: Up export async function updateUserVoiceState(bot: Bot, guildId: bigint, options: UpdateOthersVoiceState) { await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.UPDATE_VOICE_STATE(guildId, options.userId), { channel_id: options.channelId, diff --git a/helpers/discovery/addDiscoverySubcategory.ts b/helpers/discovery/addDiscoverySubcategory.ts index 6073121d0..858ac2cab 100644 --- a/helpers/discovery/addDiscoverySubcategory.ts +++ b/helpers/discovery/addDiscoverySubcategory.ts @@ -5,7 +5,7 @@ import { DiscordAddGuildDiscoverySubcategory } from "../../types/discord.ts"; export async function addDiscoverySubcategory(bot: Bot, guildId: bigint, categoryId: number) { await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.DISCOVERY_SUBCATEGORY(guildId, categoryId), ); } diff --git a/helpers/discovery/editDiscovery.ts b/helpers/discovery/editDiscovery.ts index fe8048065..65d679546 100644 --- a/helpers/discovery/editDiscovery.ts +++ b/helpers/discovery/editDiscovery.ts @@ -5,7 +5,7 @@ import { DiscordDiscoveryMetadata } from "../../types/discord.ts"; export async function editDiscovery(bot: Bot, guildId: bigint, data: ModifyGuildDiscoveryMetadata) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.DISCOVERY_METADATA(guildId), { primary_category_id: data.primaryCategoryId, diff --git a/helpers/discovery/getDiscovery.ts b/helpers/discovery/getDiscovery.ts index 4d82b5940..38d2c8fa1 100644 --- a/helpers/discovery/getDiscovery.ts +++ b/helpers/discovery/getDiscovery.ts @@ -5,7 +5,7 @@ import { DiscordDiscoveryMetadata } from "../../types/discord.ts"; export async function getDiscovery(bot: Bot, guildId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.DISCOVERY_METADATA(guildId), ); diff --git a/helpers/discovery/getDiscoveryCategories.ts b/helpers/discovery/getDiscoveryCategories.ts index 8bbcfebb3..8bc2ac5e3 100644 --- a/helpers/discovery/getDiscoveryCategories.ts +++ b/helpers/discovery/getDiscoveryCategories.ts @@ -6,7 +6,7 @@ import { DiscordDiscoveryCategory } from "../../types/discord.ts"; export async function getDiscoveryCategories(bot: Bot) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.DISCOVERY_CATEGORIES(), ); diff --git a/helpers/discovery/removeDiscoverySubcategory.ts b/helpers/discovery/removeDiscoverySubcategory.ts index ac7102fc9..6837ed79e 100644 --- a/helpers/discovery/removeDiscoverySubcategory.ts +++ b/helpers/discovery/removeDiscoverySubcategory.ts @@ -4,7 +4,7 @@ import type { Bot } from "../../bot.ts"; export async function removeDiscoverySubcategory(bot: Bot, guildId: bigint, categoryId: number) { await bot.rest.runMethod( bot.rest, - "delete", + "DELETE", bot.constants.routes.DISCOVERY_SUBCATEGORY(guildId, categoryId), ); } diff --git a/helpers/discovery/validDiscoveryTerm.ts b/helpers/discovery/validDiscoveryTerm.ts index 1d6997126..f34833809 100644 --- a/helpers/discovery/validDiscoveryTerm.ts +++ b/helpers/discovery/validDiscoveryTerm.ts @@ -4,7 +4,7 @@ import { DiscordValidateDiscoverySearchTerm } from "../../types/discord.ts"; export async function validDiscoveryTerm(bot: Bot, term: string) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.DISCOVERY_VALID_TERM(term), ); diff --git a/helpers/emojis/createEmoji.ts b/helpers/emojis/createEmoji.ts index d21f32d93..a94d56d5f 100644 --- a/helpers/emojis/createEmoji.ts +++ b/helpers/emojis/createEmoji.ts @@ -9,7 +9,7 @@ export async function createEmoji(bot: Bot, guildId: bigint, options: CreateGuil const emoji = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.GUILD_EMOJIS(guildId), { name: options.name, diff --git a/helpers/emojis/deleteEmoji.ts b/helpers/emojis/deleteEmoji.ts index 92325e844..c03982adc 100644 --- a/helpers/emojis/deleteEmoji.ts +++ b/helpers/emojis/deleteEmoji.ts @@ -2,7 +2,7 @@ import type { Bot } from "../../bot.ts"; /** Delete the given emoji. Requires the MANAGE_EMOJIS permission. Returns 204 No Content on success. */ export async function deleteEmoji(bot: Bot, guildId: bigint, id: bigint, reason?: string) { - await bot.rest.runMethod(bot.rest, "delete", bot.constants.routes.GUILD_EMOJI(guildId, id), { + await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.GUILD_EMOJI(guildId, id), { reason, }); } diff --git a/helpers/emojis/editEmoji.ts b/helpers/emojis/editEmoji.ts index d746e551c..6bee65478 100644 --- a/helpers/emojis/editEmoji.ts +++ b/helpers/emojis/editEmoji.ts @@ -5,7 +5,7 @@ import { DiscordEmoji } from "../../types/discord.ts"; export async function editEmoji(bot: Bot, guildId: bigint, id: bigint, options: ModifyGuildEmoji) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.GUILD_EMOJI(guildId, id), { name: options.name, diff --git a/helpers/emojis/getEmoji.ts b/helpers/emojis/getEmoji.ts index 14aa995c7..f96c1cecc 100644 --- a/helpers/emojis/getEmoji.ts +++ b/helpers/emojis/getEmoji.ts @@ -7,7 +7,7 @@ import { DiscordEmoji } from "../../types/discord.ts"; export async function getEmoji(bot: Bot, guildId: bigint, emojiId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_EMOJI(guildId, emojiId), ); diff --git a/helpers/emojis/getEmojis.ts b/helpers/emojis/getEmojis.ts index 9ae389f46..c51529cc1 100644 --- a/helpers/emojis/getEmojis.ts +++ b/helpers/emojis/getEmojis.ts @@ -8,7 +8,7 @@ import { Collection } from "../../util/collection.ts"; export async function getEmojis(bot: Bot, guildId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_EMOJIS(guildId), ); diff --git a/helpers/guilds/createGuild.ts b/helpers/guilds/createGuild.ts index 03e6114f3..39084574c 100644 --- a/helpers/guilds/createGuild.ts +++ b/helpers/guilds/createGuild.ts @@ -11,7 +11,7 @@ import { /** Create a new guild. Returns a guild object on success. Fires a Guild Create Gateway event. This endpoint can be used only by bots in less than 10 guilds. */ export async function createGuild(bot: Bot, options: CreateGuild) { - const result = await bot.rest.runMethod(bot.rest, "post", bot.constants.routes.GUILDS(), { + const result = await bot.rest.runMethod(bot.rest, "POST", bot.constants.routes.GUILDS(), { name: options.name, afk_channel_id: options.afkChannelId, afk_timeout: options.afkTimeout, diff --git a/helpers/guilds/deleteGuild.ts b/helpers/guilds/deleteGuild.ts index 0c07eb316..98b083815 100644 --- a/helpers/guilds/deleteGuild.ts +++ b/helpers/guilds/deleteGuild.ts @@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts"; /** Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event. */ export async function deleteGuild(bot: Bot, guildId: bigint) { - await bot.rest.runMethod(bot.rest, "delete", bot.constants.routes.GUILD(guildId)); + await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.GUILD(guildId)); } diff --git a/helpers/guilds/editGuild.ts b/helpers/guilds/editGuild.ts index 748a52611..f0d21d6ac 100644 --- a/helpers/guilds/editGuild.ts +++ b/helpers/guilds/editGuild.ts @@ -24,7 +24,7 @@ export async function editGuild(bot: Bot, guildId: bigint, options: ModifyGuild, const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.GUILD(guildId), options, ); diff --git a/helpers/guilds/editWelcomeScreen.ts b/helpers/guilds/editWelcomeScreen.ts index 907055c20..aabb30645 100644 --- a/helpers/guilds/editWelcomeScreen.ts +++ b/helpers/guilds/editWelcomeScreen.ts @@ -4,7 +4,7 @@ import { DiscordWelcomeScreen } from "../../types/discord.ts"; export async function editWelcomeScreen(bot: Bot, guildId: bigint, options: ModifyGuildWelcomeScreen) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.GUILD_WELCOME_SCREEN(guildId), { enabled: options.enabled, diff --git a/helpers/guilds/editWidget.ts b/helpers/guilds/editWidget.ts index e72c0e8df..dea1df89b 100644 --- a/helpers/guilds/editWidget.ts +++ b/helpers/guilds/editWidget.ts @@ -5,7 +5,7 @@ import { DiscordGuildWidgetSettings } from "../../types/discord.ts"; export async function editWidget(bot: Bot, guildId: bigint, enabled: boolean, channelId?: string | null) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.GUILD_WIDGET(guildId), { enabled, diff --git a/helpers/guilds/getAuditLogs.ts b/helpers/guilds/getAuditLogs.ts index e7a2b336e..157b69271 100644 --- a/helpers/guilds/getAuditLogs.ts +++ b/helpers/guilds/getAuditLogs.ts @@ -8,7 +8,7 @@ export async function getAuditLogs(bot: Bot, guildId: bigint, options?: GetGuild const auditlog = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_AUDIT_LOGS(guildId, options), ); diff --git a/helpers/guilds/getAvailableVoiceRegions.ts b/helpers/guilds/getAvailableVoiceRegions.ts index ad9f3a6ee..91a6a1cf2 100644 --- a/helpers/guilds/getAvailableVoiceRegions.ts +++ b/helpers/guilds/getAvailableVoiceRegions.ts @@ -6,7 +6,7 @@ import { Collection } from "../../util/collection.ts"; export async function getAvailableVoiceRegions(bot: Bot) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.VOICE_REGIONS(), ); diff --git a/helpers/guilds/getBan.ts b/helpers/guilds/getBan.ts index a9e109498..b2ab5e0bf 100644 --- a/helpers/guilds/getBan.ts +++ b/helpers/guilds/getBan.ts @@ -5,7 +5,7 @@ import { DiscordBan } from "../../types/discord.ts"; export async function getBan(bot: Bot, guildId: bigint, memberId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_BAN(guildId, memberId), ); diff --git a/helpers/guilds/getBans.ts b/helpers/guilds/getBans.ts index 7f79086d0..9c3268e8f 100644 --- a/helpers/guilds/getBans.ts +++ b/helpers/guilds/getBans.ts @@ -7,7 +7,7 @@ import { User } from "../../transformers/member.ts"; export async function getBans(bot: Bot, guildId: bigint, options?: GetBans) { const results = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_BANS(guildId, options), ); diff --git a/helpers/guilds/getGuild.ts b/helpers/guilds/getGuild.ts index ecc068255..9b544057d 100644 --- a/helpers/guilds/getGuild.ts +++ b/helpers/guilds/getGuild.ts @@ -14,7 +14,7 @@ export async function getGuild( ) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD(guildId, options.counts), ); diff --git a/helpers/guilds/getGuildPreview.ts b/helpers/guilds/getGuildPreview.ts index e34b31237..3d84abce9 100644 --- a/helpers/guilds/getGuildPreview.ts +++ b/helpers/guilds/getGuildPreview.ts @@ -5,7 +5,7 @@ import { DiscordGuildPreview } from "../../types/discord.ts"; export async function getGuildPreview(bot: Bot, guildId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_PREVIEW(guildId), ); diff --git a/helpers/guilds/getPruneCount.ts b/helpers/guilds/getPruneCount.ts index 9e9549eb5..e22901124 100644 --- a/helpers/guilds/getPruneCount.ts +++ b/helpers/guilds/getPruneCount.ts @@ -7,7 +7,7 @@ export async function getPruneCount(bot: Bot, guildId: bigint, options?: GetGuil const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_PRUNE(guildId), ); diff --git a/helpers/guilds/getVanityUrl.ts b/helpers/guilds/getVanityUrl.ts index 242678e59..faeb02bed 100644 --- a/helpers/guilds/getVanityUrl.ts +++ b/helpers/guilds/getVanityUrl.ts @@ -5,7 +5,7 @@ import { DiscordInviteMetadata } from "../../types/discord.ts"; export async function getVanityUrl(bot: Bot, guildId: bigint) { const result = await bot.rest.runMethod>( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_VANITY_URL(guildId), ); diff --git a/helpers/guilds/getVoiceRegions.ts b/helpers/guilds/getVoiceRegions.ts index 7554f429b..490cb91af 100644 --- a/helpers/guilds/getVoiceRegions.ts +++ b/helpers/guilds/getVoiceRegions.ts @@ -6,7 +6,7 @@ import { DiscordVoiceRegion } from "../../types/discord.ts"; export async function getVoiceRegions(bot: Bot, guildId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_REGIONS(guildId), ); diff --git a/helpers/guilds/getWelcomeScreen.ts b/helpers/guilds/getWelcomeScreen.ts index 8970273e5..d6c7aecd7 100644 --- a/helpers/guilds/getWelcomeScreen.ts +++ b/helpers/guilds/getWelcomeScreen.ts @@ -5,7 +5,7 @@ import { DiscordWelcomeScreen } from "../../types/discord.ts"; export async function getWelcomeScreen(bot: Bot, guildId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_WELCOME_SCREEN(guildId), ); diff --git a/helpers/guilds/getWidget.ts b/helpers/guilds/getWidget.ts index 55ff153e7..e96bc7fad 100644 --- a/helpers/guilds/getWidget.ts +++ b/helpers/guilds/getWidget.ts @@ -5,7 +5,7 @@ import { DiscordGuildWidget } from "../../types/discord.ts"; export async function getWidget(bot: Bot, guildId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_WIDGET_JSON(guildId), ); diff --git a/helpers/guilds/getWidgetSettings.ts b/helpers/guilds/getWidgetSettings.ts index 38d841464..caacdadb2 100644 --- a/helpers/guilds/getWidgetSettings.ts +++ b/helpers/guilds/getWidgetSettings.ts @@ -5,7 +5,7 @@ import { DiscordGuildWidgetSettings } from "../../types/discord.ts"; export async function getWidgetSettings(bot: Bot, guildId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_WIDGET(guildId), ); diff --git a/helpers/guilds/leaveGuild.ts b/helpers/guilds/leaveGuild.ts index d8c0f88b0..1d998af1b 100644 --- a/helpers/guilds/leaveGuild.ts +++ b/helpers/guilds/leaveGuild.ts @@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts"; /** Leave a guild */ export async function leaveGuild(bot: Bot, guildId: bigint) { - await bot.rest.runMethod(bot.rest, "delete", bot.constants.routes.GUILD_LEAVE(guildId)); + await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.GUILD_LEAVE(guildId)); } diff --git a/helpers/guilds/scheduledEvents/createScheduledEvent.ts b/helpers/guilds/scheduledEvents/createScheduledEvent.ts index 5a346a11f..2407f6a0c 100644 --- a/helpers/guilds/scheduledEvents/createScheduledEvent.ts +++ b/helpers/guilds/scheduledEvents/createScheduledEvent.ts @@ -28,7 +28,7 @@ export async function createScheduledEvent(bot: Bot, guildId: bigint, options: C const event = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.GUILD_SCHEDULED_EVENTS(guildId), { channel_id: options.channelId?.toString(), diff --git a/helpers/guilds/scheduledEvents/deleteScheduledEvent.ts b/helpers/guilds/scheduledEvents/deleteScheduledEvent.ts index 0b74bd1ee..c8f6dec82 100644 --- a/helpers/guilds/scheduledEvents/deleteScheduledEvent.ts +++ b/helpers/guilds/scheduledEvents/deleteScheduledEvent.ts @@ -4,7 +4,7 @@ import { Bot } from "../../../bot.ts"; export async function deleteScheduledEvent(bot: Bot, guildId: bigint, eventId: bigint) { await bot.rest.runMethod( bot.rest, - "delete", + "DELETE", bot.constants.routes.GUILD_SCHEDULED_EVENT(guildId, eventId), ); } diff --git a/helpers/guilds/scheduledEvents/editScheduledEvent.ts b/helpers/guilds/scheduledEvents/editScheduledEvent.ts index d21e06655..405d6034c 100644 --- a/helpers/guilds/scheduledEvents/editScheduledEvent.ts +++ b/helpers/guilds/scheduledEvents/editScheduledEvent.ts @@ -24,7 +24,7 @@ export async function editScheduledEvent( const event = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.GUILD_SCHEDULED_EVENT(guildId, eventId), { channel_id: options.channelId === null ? null : options.channelId?.toString(), diff --git a/helpers/guilds/scheduledEvents/getScheduledEvent.ts b/helpers/guilds/scheduledEvents/getScheduledEvent.ts index bb8d9ad05..fbfce76ad 100644 --- a/helpers/guilds/scheduledEvents/getScheduledEvent.ts +++ b/helpers/guilds/scheduledEvents/getScheduledEvent.ts @@ -10,7 +10,7 @@ export async function getScheduledEvent( ) { const event = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_SCHEDULED_EVENT(guildId, eventId, options?.withUserCount), ); diff --git a/helpers/guilds/scheduledEvents/getScheduledEventUsers.ts b/helpers/guilds/scheduledEvents/getScheduledEventUsers.ts index 90fb6ad74..6fdb1c202 100644 --- a/helpers/guilds/scheduledEvents/getScheduledEventUsers.ts +++ b/helpers/guilds/scheduledEvents/getScheduledEventUsers.ts @@ -36,7 +36,7 @@ export async function getScheduledEventUsers( const result = await bot.rest.runMethod<{ user: DiscordUser; member?: DiscordMember }[]>( bot.rest, - "get", + "GET", url, ); diff --git a/helpers/guilds/scheduledEvents/getScheduledEvents.ts b/helpers/guilds/scheduledEvents/getScheduledEvents.ts index b285a805e..69d35bc47 100644 --- a/helpers/guilds/scheduledEvents/getScheduledEvents.ts +++ b/helpers/guilds/scheduledEvents/getScheduledEvents.ts @@ -7,7 +7,7 @@ import { Collection } from "../../../util/collection.ts"; export async function getScheduledEvents(bot: Bot, guildId: bigint, options?: GetScheduledEvents) { const events = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_SCHEDULED_EVENTS(guildId, options?.withUserCount), ); diff --git a/helpers/integrations/deleteIntegration.ts b/helpers/integrations/deleteIntegration.ts index 4062b2034..19d0cb431 100644 --- a/helpers/integrations/deleteIntegration.ts +++ b/helpers/integrations/deleteIntegration.ts @@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts"; /** Delete the attached integration object for the guild with this id. Requires MANAGE_GUILD permission. */ export async function deleteIntegration(bot: Bot, guildId: bigint, id: bigint) { - await bot.rest.runMethod(bot.rest, "delete", bot.constants.routes.GUILD_INTEGRATION(guildId, id)); + await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.GUILD_INTEGRATION(guildId, id)); } diff --git a/helpers/integrations/getIntegrations.ts b/helpers/integrations/getIntegrations.ts index 9f430d773..b244a347a 100644 --- a/helpers/integrations/getIntegrations.ts +++ b/helpers/integrations/getIntegrations.ts @@ -6,7 +6,7 @@ import { DiscordIntegration } from "../../types/discord.ts"; export async function getIntegrations(bot: Bot, guildId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_INTEGRATIONS(guildId), ); diff --git a/helpers/interactions/commands/createApplicationCommand.ts b/helpers/interactions/commands/createApplicationCommand.ts index ed8fd1160..0c95960ac 100644 --- a/helpers/interactions/commands/createApplicationCommand.ts +++ b/helpers/interactions/commands/createApplicationCommand.ts @@ -21,7 +21,7 @@ export async function createApplicationCommand( ) { const result = await bot.rest.runMethod( bot.rest, - "post", + "POST", guildId ? bot.constants.routes.COMMANDS_GUILD(bot.applicationId, guildId) : bot.constants.routes.COMMANDS(bot.applicationId), diff --git a/helpers/interactions/commands/deleteApplicationCommand.ts b/helpers/interactions/commands/deleteApplicationCommand.ts index 793253993..ea4fe49c4 100644 --- a/helpers/interactions/commands/deleteApplicationCommand.ts +++ b/helpers/interactions/commands/deleteApplicationCommand.ts @@ -4,7 +4,7 @@ import type { Bot } from "../../../bot.ts"; export async function deleteApplicationCommand(bot: Bot, id: bigint, guildId?: bigint) { await bot.rest.runMethod( bot.rest, - "delete", + "DELETE", guildId ? bot.constants.routes.COMMANDS_GUILD_ID(bot.applicationId, guildId, id) : bot.constants.routes.COMMANDS_ID(bot.applicationId, id), diff --git a/helpers/interactions/commands/deleteInteractionResponse.ts b/helpers/interactions/commands/deleteInteractionResponse.ts index ac3f50317..7bdcb5808 100644 --- a/helpers/interactions/commands/deleteInteractionResponse.ts +++ b/helpers/interactions/commands/deleteInteractionResponse.ts @@ -4,7 +4,7 @@ import type { Bot } from "../../../bot.ts"; export async function deleteInteractionResponse(bot: Bot, token: string, messageId?: bigint) { await bot.rest.runMethod( bot.rest, - "delete", + "DELETE", messageId ? bot.constants.routes.INTERACTION_ID_TOKEN_MESSAGE_ID(bot.applicationId, token, messageId) : bot.constants.routes.INTERACTION_ORIGINAL_ID_TOKEN(bot.applicationId, token), diff --git a/helpers/interactions/commands/editApplicationCommandPermissions.ts b/helpers/interactions/commands/editApplicationCommandPermissions.ts index 63cce29a2..598327e78 100644 --- a/helpers/interactions/commands/editApplicationCommandPermissions.ts +++ b/helpers/interactions/commands/editApplicationCommandPermissions.ts @@ -13,7 +13,7 @@ export async function editApplicationCommandPermissions( ) { const result = await bot.rest.runMethod( bot.rest, - "put", + "PUT", bot.constants.routes.COMMANDS_PERMISSION(bot.applicationId, guildId, commandId), { permissions: options, diff --git a/helpers/interactions/commands/editInteractionResponse.ts b/helpers/interactions/commands/editInteractionResponse.ts index 9b9da11dc..8a287cef2 100644 --- a/helpers/interactions/commands/editInteractionResponse.ts +++ b/helpers/interactions/commands/editInteractionResponse.ts @@ -13,7 +13,7 @@ export async function editInteractionResponse( ) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", options.messageId ? bot.constants.routes.WEBHOOK_MESSAGE(bot.applicationId, token, options.messageId) : bot.constants.routes.INTERACTION_ORIGINAL_ID_TOKEN(bot.applicationId, token), diff --git a/helpers/interactions/commands/getApplicationCommand.ts b/helpers/interactions/commands/getApplicationCommand.ts index 25d69036d..8f4f4d10c 100644 --- a/helpers/interactions/commands/getApplicationCommand.ts +++ b/helpers/interactions/commands/getApplicationCommand.ts @@ -5,7 +5,7 @@ import { DiscordApplicationCommand } from "../../../types/discord.ts"; export async function getApplicationCommand(bot: Bot, commandId: bigint, options?: GetApplicationCommand) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", options?.guildId ? bot.constants.routes.COMMANDS_GUILD_ID( bot.applicationId, diff --git a/helpers/interactions/commands/getApplicationCommandPermission.ts b/helpers/interactions/commands/getApplicationCommandPermission.ts index a6b40daa6..db51ecb53 100644 --- a/helpers/interactions/commands/getApplicationCommandPermission.ts +++ b/helpers/interactions/commands/getApplicationCommandPermission.ts @@ -5,7 +5,7 @@ import { DiscordGuildApplicationCommandPermissions } from "../../../types/discor export async function getApplicationCommandPermission(bot: Bot, guildId: bigint, commandId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.COMMANDS_PERMISSION(bot.applicationId, guildId, commandId), ); diff --git a/helpers/interactions/commands/getApplicationCommandPermissions.ts b/helpers/interactions/commands/getApplicationCommandPermissions.ts index 463c95ce1..b3e1d81af 100644 --- a/helpers/interactions/commands/getApplicationCommandPermissions.ts +++ b/helpers/interactions/commands/getApplicationCommandPermissions.ts @@ -6,7 +6,7 @@ import { Collection } from "../../../util/collection.ts"; export async function getApplicationCommandPermissions(bot: Bot, guildId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.COMMANDS_PERMISSIONS(bot.applicationId, guildId), ); diff --git a/helpers/interactions/commands/getApplicationCommands.ts b/helpers/interactions/commands/getApplicationCommands.ts index 91d078a67..65022d09b 100644 --- a/helpers/interactions/commands/getApplicationCommands.ts +++ b/helpers/interactions/commands/getApplicationCommands.ts @@ -6,7 +6,7 @@ import { DiscordApplicationCommand } from "../../../types/discord.ts"; export async function getApplicationCommands(bot: Bot, guildId?: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", guildId ? bot.constants.routes.COMMANDS_GUILD(bot.applicationId, guildId) : bot.constants.routes.COMMANDS(bot.applicationId), diff --git a/helpers/interactions/commands/upsertApplicationCommand.ts b/helpers/interactions/commands/upsertApplicationCommand.ts index acd078be7..c04f6cad5 100644 --- a/helpers/interactions/commands/upsertApplicationCommand.ts +++ b/helpers/interactions/commands/upsertApplicationCommand.ts @@ -19,7 +19,7 @@ export async function upsertApplicationCommand( ) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", guildId ? bot.constants.routes.COMMANDS_GUILD_ID(bot.applicationId, guildId, commandId) : bot.constants.routes.COMMANDS_ID(bot.applicationId, commandId), diff --git a/helpers/interactions/commands/upsertApplicationCommands.ts b/helpers/interactions/commands/upsertApplicationCommands.ts index 97b94477d..cc0cb300b 100644 --- a/helpers/interactions/commands/upsertApplicationCommands.ts +++ b/helpers/interactions/commands/upsertApplicationCommands.ts @@ -21,7 +21,7 @@ export async function upsertApplicationCommands( ) { const result = await bot.rest.runMethod( bot.rest, - "put", + "PUT", guildId ? bot.constants.routes.COMMANDS_GUILD(bot.applicationId, guildId) : bot.constants.routes.COMMANDS(bot.applicationId), diff --git a/helpers/interactions/followups/deleteFollowupMessage.ts b/helpers/interactions/followups/deleteFollowupMessage.ts index 3af1c10ec..3d084441d 100644 --- a/helpers/interactions/followups/deleteFollowupMessage.ts +++ b/helpers/interactions/followups/deleteFollowupMessage.ts @@ -4,7 +4,7 @@ import { Bot } from "../../../bot.ts"; export async function deleteFollowupMessage(bot: Bot, interactionToken: string, messageId: bigint) { await bot.rest.runMethod( bot.rest, - "delete", + "DELETE", bot.constants.routes.WEBHOOK_MESSAGE(bot.applicationId, interactionToken, messageId), ); } diff --git a/helpers/interactions/followups/editFollowupMessage.ts b/helpers/interactions/followups/editFollowupMessage.ts index c14e211b9..ce1361808 100644 --- a/helpers/interactions/followups/editFollowupMessage.ts +++ b/helpers/interactions/followups/editFollowupMessage.ts @@ -12,7 +12,7 @@ export async function editFollowupMessage( ) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.WEBHOOK_MESSAGE(bot.applicationId, interactionToken, messageId), { content: options.content, diff --git a/helpers/interactions/followups/getFollowupMessage.ts b/helpers/interactions/followups/getFollowupMessage.ts index 4cff347e2..0cc79d125 100644 --- a/helpers/interactions/followups/getFollowupMessage.ts +++ b/helpers/interactions/followups/getFollowupMessage.ts @@ -5,7 +5,7 @@ import { DiscordMessage } from "../../../types/discord.ts"; export async function getFollowupMessage(bot: Bot, interactionToken: string, messageId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.WEBHOOK_MESSAGE(bot.applicationId, interactionToken, messageId), ); diff --git a/helpers/interactions/getOriginalInteractionResponse.ts b/helpers/interactions/getOriginalInteractionResponse.ts index a667ccc6f..e6f5ca1e2 100644 --- a/helpers/interactions/getOriginalInteractionResponse.ts +++ b/helpers/interactions/getOriginalInteractionResponse.ts @@ -5,7 +5,7 @@ import { DiscordMessage } from "../../types/discord.ts"; export async function getOriginalInteractionResponse(bot: Bot, token: string) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.INTERACTION_ORIGINAL_ID_TOKEN(bot.applicationId, token), ); diff --git a/helpers/interactions/sendInteractionResponse.ts b/helpers/interactions/sendInteractionResponse.ts index 6ac0d150d..b7aeafc5e 100644 --- a/helpers/interactions/sendInteractionResponse.ts +++ b/helpers/interactions/sendInteractionResponse.ts @@ -99,7 +99,7 @@ export async function sendInteractionResponse( if (bot.cache.unrepliedInteractions.delete(id)) { return await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.INTERACTION_ID_TOKEN(id, token), { type: options.type, @@ -112,7 +112,7 @@ export async function sendInteractionResponse( // If its already been executed, we need to send a followup response const result = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.WEBHOOK(bot.applicationId, token), { ...data, file: options.data.file }, ); diff --git a/helpers/invites/createInvite.ts b/helpers/invites/createInvite.ts index d17b7837a..498baa216 100644 --- a/helpers/invites/createInvite.ts +++ b/helpers/invites/createInvite.ts @@ -6,7 +6,7 @@ import { InviteTargetTypes } from "../../types/shared.ts"; export async function createInvite(bot: Bot, channelId: bigint, options: CreateChannelInvite = {}) { const result = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.CHANNEL_INVITES(channelId), { max_age: options.maxAge, diff --git a/helpers/invites/deleteInvite.ts b/helpers/invites/deleteInvite.ts index c459c36ff..21f7ee839 100644 --- a/helpers/invites/deleteInvite.ts +++ b/helpers/invites/deleteInvite.ts @@ -3,5 +3,5 @@ import { DiscordInviteMetadata } from "../../types/discord.ts"; /** Deletes an invite for the given code. Requires `MANAGE_CHANNELS` or `MANAGE_GUILD` permission */ export async function deleteInvite(bot: Bot, inviteCode: string) { - await bot.rest.runMethod(bot.rest, "delete", bot.constants.routes.INVITE(inviteCode)); + await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.INVITE(inviteCode)); } diff --git a/helpers/invites/getChannelInvites.ts b/helpers/invites/getChannelInvites.ts index 580f22952..becc88e58 100644 --- a/helpers/invites/getChannelInvites.ts +++ b/helpers/invites/getChannelInvites.ts @@ -6,7 +6,7 @@ import { DiscordInviteMetadata } from "../../types/discord.ts"; export async function getChannelInvites(bot: Bot, channelId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.CHANNEL_INVITES(channelId), ); diff --git a/helpers/invites/getInvite.ts b/helpers/invites/getInvite.ts index 9fc59f147..034eee463 100644 --- a/helpers/invites/getInvite.ts +++ b/helpers/invites/getInvite.ts @@ -5,7 +5,7 @@ import { DiscordInviteMetadata } from "../../types/discord.ts"; export async function getInvite(bot: Bot, inviteCode: string, options?: GetInvite) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.INVITE(inviteCode, options), ); diff --git a/helpers/invites/getInvites.ts b/helpers/invites/getInvites.ts index 470bb9cc7..d7509a7a5 100644 --- a/helpers/invites/getInvites.ts +++ b/helpers/invites/getInvites.ts @@ -6,7 +6,7 @@ import { DiscordInviteMetadata } from "../../types/discord.ts"; export async function getInvites(bot: Bot, guildId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_INVITES(guildId), ); diff --git a/helpers/members/banMember.ts b/helpers/members/banMember.ts index fbaa77ec7..168d4769b 100644 --- a/helpers/members/banMember.ts +++ b/helpers/members/banMember.ts @@ -4,7 +4,7 @@ import type { Bot } from "../../bot.ts"; export async function banMember(bot: Bot, guildId: bigint, id: bigint, options?: CreateGuildBan) { await bot.rest.runMethod( bot.rest, - "put", + "PUT", bot.constants.routes.GUILD_BAN(guildId, id), options ? { diff --git a/helpers/members/editBotNickname.ts b/helpers/members/editBotNickname.ts index decc26af8..93878ce06 100644 --- a/helpers/members/editBotNickname.ts +++ b/helpers/members/editBotNickname.ts @@ -4,7 +4,7 @@ import type { Bot } from "../../bot.ts"; export async function editBotNickname(bot: Bot, guildId: bigint, options: { nick: string | null; reason?: string }) { const response = await bot.rest.runMethod<{ nick: string }>( bot.rest, - "patch", + "PATCH", bot.constants.routes.USER_NICK(guildId), options, ); diff --git a/helpers/members/editMember.ts b/helpers/members/editMember.ts index 7987c00e8..83eb254ec 100644 --- a/helpers/members/editMember.ts +++ b/helpers/members/editMember.ts @@ -5,7 +5,7 @@ import { DiscordMemberWithUser } from "../../types/discord.ts"; export async function editMember(bot: Bot, guildId: bigint, memberId: bigint, options: ModifyGuildMember) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.GUILD_MEMBER(guildId, memberId), { nick: options.nick, diff --git a/helpers/members/getDmChannel.ts b/helpers/members/getDmChannel.ts index 77c28507a..ac181495a 100644 --- a/helpers/members/getDmChannel.ts +++ b/helpers/members/getDmChannel.ts @@ -5,7 +5,7 @@ import { DiscordChannel } from "../../types/discord.ts"; export async function getDmChannel(bot: Bot, userId: bigint) { if (userId === bot.id) throw new Error(bot.constants.Errors.YOU_CAN_NOT_DM_THE_BOT_ITSELF); - const dmChannelData = await bot.rest.runMethod(bot.rest, "post", bot.constants.routes.USER_DM(), { + const dmChannelData = await bot.rest.runMethod(bot.rest, "POST", bot.constants.routes.USER_DM(), { recipient_id: userId.toString(), }); diff --git a/helpers/members/getMember.ts b/helpers/members/getMember.ts index 0a3015cd2..c2762c999 100644 --- a/helpers/members/getMember.ts +++ b/helpers/members/getMember.ts @@ -5,7 +5,7 @@ import { DiscordMemberWithUser } from "../../types/discord.ts"; export async function getMember(bot: Bot, guildId: bigint, id: bigint) { const data = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_MEMBER(guildId, id), ); diff --git a/helpers/members/getMembers.ts b/helpers/members/getMembers.ts index c022e88b2..f35923448 100644 --- a/helpers/members/getMembers.ts +++ b/helpers/members/getMembers.ts @@ -11,7 +11,7 @@ import { Collection } from "../../util/collection.ts"; export async function getMembers(bot: Bot, guildId: bigint, options: ListGuildMembers) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_MEMBERS(guildId, options), ); diff --git a/helpers/members/kickMember.ts b/helpers/members/kickMember.ts index 4b86363ab..fddca3e9d 100644 --- a/helpers/members/kickMember.ts +++ b/helpers/members/kickMember.ts @@ -2,7 +2,7 @@ import { Bot } from "../../bot.ts"; /** Kick a member from the server */ export async function kickMember(bot: Bot, guildId: bigint, memberId: bigint, reason?: string) { - await bot.rest.runMethod(bot.rest, "delete", bot.constants.routes.GUILD_MEMBER(guildId, memberId), { + await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.GUILD_MEMBER(guildId, memberId), { reason, }); } diff --git a/helpers/members/pruneMembers.ts b/helpers/members/pruneMembers.ts index 426e9c4be..c214ddf02 100644 --- a/helpers/members/pruneMembers.ts +++ b/helpers/members/pruneMembers.ts @@ -11,7 +11,7 @@ export async function pruneMembers(bot: Bot, guildId: bigint, options: BeginGuil const result = await bot.rest.runMethod<{ pruned: number }>( bot.rest, - "post", + "POST", bot.constants.routes.GUILD_PRUNE(guildId), { days: options.days, diff --git a/helpers/members/searchMembers.ts b/helpers/members/searchMembers.ts index 08953c9ed..457652f12 100644 --- a/helpers/members/searchMembers.ts +++ b/helpers/members/searchMembers.ts @@ -22,7 +22,7 @@ export async function searchMembers( const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_MEMBERS_SEARCH(guildId, query, options), ); diff --git a/helpers/members/unbanMember.ts b/helpers/members/unbanMember.ts index 653b6c9a9..81027d125 100644 --- a/helpers/members/unbanMember.ts +++ b/helpers/members/unbanMember.ts @@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts"; /** Remove the ban for a user. Requires BAN_MEMBERS permission */ export async function unbanMember(bot: Bot, guildId: bigint, id: bigint) { - await bot.rest.runMethod(bot.rest, "delete", bot.constants.routes.GUILD_BAN(guildId, id)); + await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.GUILD_BAN(guildId, id)); } diff --git a/helpers/messages/addReaction.ts b/helpers/messages/addReaction.ts index d28d2b749..2937cf55a 100644 --- a/helpers/messages/addReaction.ts +++ b/helpers/messages/addReaction.ts @@ -10,7 +10,7 @@ export async function addReaction(bot: Bot, channelId: bigint, messageId: bigint await bot.rest.runMethod( bot.rest, - "put", + "PUT", bot.constants.routes.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, reaction), {}, ); diff --git a/helpers/messages/deleteMessage.ts b/helpers/messages/deleteMessage.ts index 924fa195d..a52895fc0 100644 --- a/helpers/messages/deleteMessage.ts +++ b/helpers/messages/deleteMessage.ts @@ -12,7 +12,7 @@ export async function deleteMessage( await bot.rest.runMethod( bot.rest, - "delete", + "DELETE", bot.constants.routes.CHANNEL_MESSAGE(channelId, messageId), { reason }, ); diff --git a/helpers/messages/deleteMessages.ts b/helpers/messages/deleteMessages.ts index 1c85daaa5..9f05d3852 100644 --- a/helpers/messages/deleteMessages.ts +++ b/helpers/messages/deleteMessages.ts @@ -10,7 +10,7 @@ export async function deleteMessages(bot: Bot, channelId: bigint, ids: bigint[], console.warn(`This endpoint only accepts a maximum of 100 messages. Deleting the first 100 message ids provided.`); } - await bot.rest.runMethod(bot.rest, "post", bot.constants.routes.CHANNEL_BULK_DELETE(channelId), { + await bot.rest.runMethod(bot.rest, "POST", bot.constants.routes.CHANNEL_BULK_DELETE(channelId), { messages: ids.splice(0, 100).map((id) => id.toString()), reason, }); diff --git a/helpers/messages/editMessage.ts b/helpers/messages/editMessage.ts index d071ab39c..e870d9ee6 100644 --- a/helpers/messages/editMessage.ts +++ b/helpers/messages/editMessage.ts @@ -9,7 +9,7 @@ import { MessageComponentTypes } from "../../types/shared.ts"; export async function editMessage(bot: Bot, channelId: bigint, messageId: bigint, content: EditMessage) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.CHANNEL_MESSAGE(channelId, messageId), { content: content.content, diff --git a/helpers/messages/getMessage.ts b/helpers/messages/getMessage.ts index eded16751..1cc0e7c3c 100644 --- a/helpers/messages/getMessage.ts +++ b/helpers/messages/getMessage.ts @@ -5,7 +5,7 @@ import { DiscordMessage } from "../../types/discord.ts"; export async function getMessage(bot: Bot, channelId: bigint, id: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.CHANNEL_MESSAGE(channelId, id), ); diff --git a/helpers/messages/getMessages.ts b/helpers/messages/getMessages.ts index 828a9810f..da565777f 100644 --- a/helpers/messages/getMessages.ts +++ b/helpers/messages/getMessages.ts @@ -13,7 +13,7 @@ export async function getMessages( const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.CHANNEL_MESSAGES(channelId, options), ); diff --git a/helpers/messages/getReactions.ts b/helpers/messages/getReactions.ts index 5e6b0ad24..2969940de 100644 --- a/helpers/messages/getReactions.ts +++ b/helpers/messages/getReactions.ts @@ -18,7 +18,7 @@ export async function getReactions( const users = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.CHANNEL_MESSAGE_REACTION(channelId, messageId, encodeURIComponent(reaction), options), ); diff --git a/helpers/messages/pinMessage.ts b/helpers/messages/pinMessage.ts index 14bb65d7d..8665eeec8 100644 --- a/helpers/messages/pinMessage.ts +++ b/helpers/messages/pinMessage.ts @@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts"; /** Pin a message in a channel. Requires MANAGE_MESSAGES. Max pins allowed in a channel = 50. */ export async function pinMessage(bot: Bot, channelId: bigint, messageId: bigint) { - await bot.rest.runMethod(bot.rest, "put", bot.constants.routes.CHANNEL_PIN(channelId, messageId)); + await bot.rest.runMethod(bot.rest, "PUT", bot.constants.routes.CHANNEL_PIN(channelId, messageId)); } diff --git a/helpers/messages/publishMessage.ts b/helpers/messages/publishMessage.ts index 8b44ed44e..803c339a8 100644 --- a/helpers/messages/publishMessage.ts +++ b/helpers/messages/publishMessage.ts @@ -5,7 +5,7 @@ import { DiscordMessage } from "../../types/discord.ts"; export async function publishMessage(bot: Bot, channelId: bigint, messageId: bigint) { const data = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.CHANNEL_MESSAGE_CROSSPOST(channelId, messageId), ); diff --git a/helpers/messages/removeAllReactions.ts b/helpers/messages/removeAllReactions.ts index e65c76680..9c2f6a89d 100644 --- a/helpers/messages/removeAllReactions.ts +++ b/helpers/messages/removeAllReactions.ts @@ -4,7 +4,7 @@ import type { Bot } from "../../bot.ts"; export async function removeAllReactions(bot: Bot, channelId: bigint, messageId: bigint) { await bot.rest.runMethod( bot.rest, - "delete", + "DELETE", bot.constants.routes.CHANNEL_MESSAGE_REACTIONS(channelId, messageId), ); } diff --git a/helpers/messages/removeReaction.ts b/helpers/messages/removeReaction.ts index ee9c8e895..c656c44d3 100644 --- a/helpers/messages/removeReaction.ts +++ b/helpers/messages/removeReaction.ts @@ -16,7 +16,7 @@ export async function removeReaction( await bot.rest.runMethod( bot.rest, - "delete", + "DELETE", options?.userId ? bot.constants.routes.CHANNEL_MESSAGE_REACTION_USER( channelId, diff --git a/helpers/messages/removeReactionEmoji.ts b/helpers/messages/removeReactionEmoji.ts index 03f509028..a7be2349c 100644 --- a/helpers/messages/removeReactionEmoji.ts +++ b/helpers/messages/removeReactionEmoji.ts @@ -10,7 +10,7 @@ export async function removeReactionEmoji(bot: Bot, channelId: bigint, messageId await bot.rest.runMethod( bot.rest, - "delete", + "DELETE", bot.constants.routes.CHANNEL_MESSAGE_REACTION(channelId, messageId, reaction), ); } diff --git a/helpers/messages/sendMessage.ts b/helpers/messages/sendMessage.ts index 26a973574..169603d85 100644 --- a/helpers/messages/sendMessage.ts +++ b/helpers/messages/sendMessage.ts @@ -8,7 +8,7 @@ import { Embed } from "../../transformers/embed.ts"; export async function sendMessage(bot: Bot, channelId: bigint, content: CreateMessage) { const result = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.CHANNEL_MESSAGES(channelId), { content: content.content, diff --git a/helpers/messages/unpinMessage.ts b/helpers/messages/unpinMessage.ts index bbc538f8f..1577d00b9 100644 --- a/helpers/messages/unpinMessage.ts +++ b/helpers/messages/unpinMessage.ts @@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts"; export async function unpinMessage(bot: Bot, channelId: bigint, messageId: bigint) { - await bot.rest.runMethod(bot.rest, "delete", bot.constants.routes.CHANNEL_PIN(channelId, messageId)); + await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.CHANNEL_PIN(channelId, messageId)); } diff --git a/helpers/misc/editBotProfile.ts b/helpers/misc/editBotProfile.ts index f3b2bd5c3..8d1c1a0ad 100644 --- a/helpers/misc/editBotProfile.ts +++ b/helpers/misc/editBotProfile.ts @@ -7,7 +7,7 @@ import { DiscordUser } from "../../types/discord.ts"; export async function editBotProfile(bot: Bot, options: { username?: string; botAvatarURL?: string | null }) { const avatar = options?.botAvatarURL ? await bot.utils.urlToBase64(options?.botAvatarURL) : options?.botAvatarURL; - const result = await bot.rest.runMethod(bot.rest, "patch", bot.constants.routes.USER_BOT(), { + const result = await bot.rest.runMethod(bot.rest, "PATCH", bot.constants.routes.USER_BOT(), { username: options.username?.trim(), avatar, }); diff --git a/helpers/misc/getGatewayBot.ts b/helpers/misc/getGatewayBot.ts index e51e647ec..3cd5ee1c8 100644 --- a/helpers/misc/getGatewayBot.ts +++ b/helpers/misc/getGatewayBot.ts @@ -3,7 +3,7 @@ import { DiscordGetGatewayBot } from "../../types/discord.ts"; /** Get the bots Gateway metadata that can help during the operation of large or sharded bots. */ export async function getGatewayBot(bot: Bot) { - const result = await bot.rest.runMethod(bot.rest, "get", bot.constants.routes.GATEWAY_BOT()); + const result = await bot.rest.runMethod(bot.rest, "GET", bot.constants.routes.GATEWAY_BOT()); return bot.transformers.gatewayBot(result); } diff --git a/helpers/misc/getUser.ts b/helpers/misc/getUser.ts index dda9d36cd..822a59a31 100644 --- a/helpers/misc/getUser.ts +++ b/helpers/misc/getUser.ts @@ -3,7 +3,7 @@ import { DiscordUser } from "../../types/discord.ts"; /** This function will return the raw user payload in the rare cases you need to fetch a user directly from the API. */ export async function getUser(bot: Bot, userId: bigint) { - const result = await bot.rest.runMethod(bot.rest, "get", bot.constants.routes.USER(userId)); + const result = await bot.rest.runMethod(bot.rest, "GET", bot.constants.routes.USER(userId)); return bot.transformers.user(bot, result); } diff --git a/helpers/misc/nitroStickerPacks.ts b/helpers/misc/nitroStickerPacks.ts index d682499fa..9fa147329 100644 --- a/helpers/misc/nitroStickerPacks.ts +++ b/helpers/misc/nitroStickerPacks.ts @@ -5,7 +5,7 @@ import { DiscordStickerPack } from "../../types/discord.ts"; export async function nitroStickerPacks(bot: Bot) { const packs = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.NITRO_STICKER_PACKS(), ); diff --git a/helpers/oauth/getApplicationInfo.ts b/helpers/oauth/getApplicationInfo.ts index fd7e78d76..5c0c31eb4 100644 --- a/helpers/oauth/getApplicationInfo.ts +++ b/helpers/oauth/getApplicationInfo.ts @@ -5,7 +5,7 @@ import { DiscordApplication } from "../../types/discord.ts"; export async function getApplicationInfo(bot: Bot) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.OAUTH2_APPLICATION(), ); diff --git a/helpers/roles/addRole.ts b/helpers/roles/addRole.ts index b0f751961..dad10f017 100644 --- a/helpers/roles/addRole.ts +++ b/helpers/roles/addRole.ts @@ -4,7 +4,7 @@ import type { Bot } from "../../bot.ts"; export async function addRole(bot: Bot, guildId: bigint, memberId: bigint, roleId: bigint, reason?: string) { await bot.rest.runMethod( bot.rest, - "put", + "PUT", bot.constants.routes.GUILD_MEMBER_ROLE(guildId, memberId, roleId), { reason }, ); diff --git a/helpers/roles/createRole.ts b/helpers/roles/createRole.ts index 715599ab9..4b342b6f0 100644 --- a/helpers/roles/createRole.ts +++ b/helpers/roles/createRole.ts @@ -4,7 +4,7 @@ import { PermissionStrings } from "../../types/shared.ts"; /** Create a new role for the guild. Requires the MANAGE_ROLES permission. */ export async function createRole(bot: Bot, guildId: bigint, options: CreateGuildRole, reason?: string) { - const result = await bot.rest.runMethod(bot.rest, "post", bot.constants.routes.GUILD_ROLES(guildId), { + const result = await bot.rest.runMethod(bot.rest, "POST", bot.constants.routes.GUILD_ROLES(guildId), { name: options.name, color: options.color, hoist: options.hoist, diff --git a/helpers/roles/deleteRole.ts b/helpers/roles/deleteRole.ts index 733353e15..d680b576e 100644 --- a/helpers/roles/deleteRole.ts +++ b/helpers/roles/deleteRole.ts @@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts"; /** Delete a guild role. Requires the MANAGE_ROLES permission. */ export async function deleteRole(bot: Bot, guildId: bigint, id: bigint) { - await bot.rest.runMethod(bot.rest, "delete", bot.constants.routes.GUILD_ROLE(guildId, id)); + await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.GUILD_ROLE(guildId, id)); } diff --git a/helpers/roles/editRole.ts b/helpers/roles/editRole.ts index 948e8aeb1..cd4f18753 100644 --- a/helpers/roles/editRole.ts +++ b/helpers/roles/editRole.ts @@ -6,7 +6,7 @@ import { PermissionStrings } from "../../types/shared.ts"; export async function editRole(bot: Bot, guildId: bigint, id: bigint, options: EditGuildRole) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.GUILD_ROLE(guildId, id), { name: options.name, diff --git a/helpers/roles/getRoles.ts b/helpers/roles/getRoles.ts index a40fc93ee..a622de83e 100644 --- a/helpers/roles/getRoles.ts +++ b/helpers/roles/getRoles.ts @@ -7,7 +7,7 @@ import { DiscordRole } from "../../types/discord.ts"; * ⚠️ **If you need this, you are probably doing something wrong. This is not intended for use. Your roles will be cached in your guild.** */ export async function getRoles(bot: Bot, guildId: bigint) { - const result = await bot.rest.runMethod(bot.rest, "get", bot.constants.routes.GUILD_ROLES(guildId)); + const result = await bot.rest.runMethod(bot.rest, "GET", bot.constants.routes.GUILD_ROLES(guildId)); const roleStructures = result.map((role) => bot.transformers.role(bot, { role, guildId })); diff --git a/helpers/roles/modifyRolePositions.ts b/helpers/roles/modifyRolePositions.ts index 11394542e..00bedd164 100644 --- a/helpers/roles/modifyRolePositions.ts +++ b/helpers/roles/modifyRolePositions.ts @@ -6,7 +6,7 @@ import { Collection } from "../../util/collection.ts"; export async function modifyRolePositions(bot: Bot, guildId: bigint, options: ModifyRolePositions[]) { const roles = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.GUILD_ROLES(guildId), options, ); diff --git a/helpers/roles/removeRole.ts b/helpers/roles/removeRole.ts index 7e2cf2e83..cc929267e 100644 --- a/helpers/roles/removeRole.ts +++ b/helpers/roles/removeRole.ts @@ -4,7 +4,7 @@ import type { Bot } from "../../bot.ts"; export async function removeRole(bot: Bot, guildId: bigint, memberId: bigint, roleId: bigint, reason?: string) { await bot.rest.runMethod( bot.rest, - "delete", + "DELETE", bot.constants.routes.GUILD_MEMBER_ROLE(guildId, memberId, roleId), { reason }, ); diff --git a/helpers/templates/createGuildFromTemplate.ts b/helpers/templates/createGuildFromTemplate.ts index e6b569305..7c9ba4ef8 100644 --- a/helpers/templates/createGuildFromTemplate.ts +++ b/helpers/templates/createGuildFromTemplate.ts @@ -12,7 +12,7 @@ export async function createGuildFromTemplate(bot: Bot, templateCode: string, da const createdGuild = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.TEMPLATE(templateCode), data, ); diff --git a/helpers/templates/createGuildTemplate.ts b/helpers/templates/createGuildTemplate.ts index ad0f5ae0a..6bbcfee76 100644 --- a/helpers/templates/createGuildTemplate.ts +++ b/helpers/templates/createGuildTemplate.ts @@ -13,7 +13,7 @@ export async function createGuildTemplate(bot: Bot, guildId: bigint, data: Creat return await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.GUILD_TEMPLATES(guildId), data, ); diff --git a/helpers/templates/deleteGuildTemplate.ts b/helpers/templates/deleteGuildTemplate.ts index 51d263ede..a57c6686b 100644 --- a/helpers/templates/deleteGuildTemplate.ts +++ b/helpers/templates/deleteGuildTemplate.ts @@ -8,7 +8,7 @@ import { DiscordTemplate } from "../../types/discord.ts"; export async function deleteGuildTemplate(bot: Bot, guildId: bigint, templateCode: string) { await bot.rest.runMethod( bot.rest, - "delete", + "DELETE", bot.constants.routes.GUILD_TEMPLATE(guildId, templateCode), ); } diff --git a/helpers/templates/editGuildTemplate.ts b/helpers/templates/editGuildTemplate.ts index f68fac58a..260626ce7 100644 --- a/helpers/templates/editGuildTemplate.ts +++ b/helpers/templates/editGuildTemplate.ts @@ -16,7 +16,7 @@ export async function editGuildTemplate(bot: Bot, guildId: bigint, templateCode: return await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.GUILD_TEMPLATE(guildId, templateCode), { name: data.name, diff --git a/helpers/templates/getGuildTemplates.ts b/helpers/templates/getGuildTemplates.ts index 6f62069fa..2830e1789 100644 --- a/helpers/templates/getGuildTemplates.ts +++ b/helpers/templates/getGuildTemplates.ts @@ -6,7 +6,7 @@ import { DiscordTemplate } from "../../types/discord.ts"; export async function getGuildTemplates(bot: Bot, guildId: bigint) { const templates = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_TEMPLATES(guildId), ); diff --git a/helpers/templates/getTemplate.ts b/helpers/templates/getTemplate.ts index 9905fa709..7ce0bb0ea 100644 --- a/helpers/templates/getTemplate.ts +++ b/helpers/templates/getTemplate.ts @@ -5,7 +5,7 @@ import { DiscordTemplate } from "../../types/discord.ts"; export async function getTemplate(bot: Bot, templateCode: string) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.TEMPLATE(templateCode), ); diff --git a/helpers/templates/syncGuildTemplate.ts b/helpers/templates/syncGuildTemplate.ts index 2e607a602..b9fc7c893 100644 --- a/helpers/templates/syncGuildTemplate.ts +++ b/helpers/templates/syncGuildTemplate.ts @@ -8,7 +8,7 @@ import { DiscordTemplate } from "../../types/discord.ts"; export async function syncGuildTemplate(bot: Bot, guildId: bigint, templateCode: string) { return await bot.rest.runMethod( bot.rest, - "put", + "PUT", bot.constants.routes.GUILD_TEMPLATE(guildId, templateCode), ); } diff --git a/helpers/webhooks/createWebhook.ts b/helpers/webhooks/createWebhook.ts index b1d153a62..bd3b1601e 100644 --- a/helpers/webhooks/createWebhook.ts +++ b/helpers/webhooks/createWebhook.ts @@ -9,7 +9,7 @@ import { DiscordWebhook } from "../../types/discord.ts"; export async function createWebhook(bot: Bot, channelId: bigint, options: CreateWebhook) { const result = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.CHANNEL_WEBHOOKS(channelId), { name: options.name, diff --git a/helpers/webhooks/deleteWebhook.ts b/helpers/webhooks/deleteWebhook.ts index 6537b75dd..10b2946fd 100644 --- a/helpers/webhooks/deleteWebhook.ts +++ b/helpers/webhooks/deleteWebhook.ts @@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts"; /** Delete a webhook permanently. Requires the `MANAGE_WEBHOOKS` permission. Returns a undefined on success */ export async function deleteWebhook(bot: Bot, webhookId: bigint, reason?: string) { - await bot.rest.runMethod(bot.rest, "delete", bot.constants.routes.WEBHOOK_ID(webhookId), { reason }); + await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.WEBHOOK_ID(webhookId), { reason }); } diff --git a/helpers/webhooks/deleteWebhookMessage.ts b/helpers/webhooks/deleteWebhookMessage.ts index 0b17e2222..2cbfcec28 100644 --- a/helpers/webhooks/deleteWebhookMessage.ts +++ b/helpers/webhooks/deleteWebhookMessage.ts @@ -14,7 +14,7 @@ export async function deleteWebhookMessage( ) { await bot.rest.runMethod( bot.rest, - "delete", + "DELETE", bot.constants.routes.WEBHOOK_MESSAGE(webhookId, webhookToken, messageId, options), ); } diff --git a/helpers/webhooks/deleteWebhookWithToken.ts b/helpers/webhooks/deleteWebhookWithToken.ts index 619aadc98..dcfe27453 100644 --- a/helpers/webhooks/deleteWebhookWithToken.ts +++ b/helpers/webhooks/deleteWebhookWithToken.ts @@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts"; /** Delete a webhook permanently. Returns a undefined on success */ export async function deleteWebhookWithToken(bot: Bot, webhookId: bigint, webhookToken: string) { - await bot.rest.runMethod(bot.rest, "delete", bot.constants.routes.WEBHOOK(webhookId, webhookToken)); + await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.WEBHOOK(webhookId, webhookToken)); } diff --git a/helpers/webhooks/editWebhook.ts b/helpers/webhooks/editWebhook.ts index 5292792f6..696cf60ef 100644 --- a/helpers/webhooks/editWebhook.ts +++ b/helpers/webhooks/editWebhook.ts @@ -5,7 +5,7 @@ import { DiscordWebhook } from "../../types/discord.ts"; export async function editWebhook(bot: Bot, webhookId: bigint, options: ModifyWebhook) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.WEBHOOK_ID(webhookId), { name: options.name, diff --git a/helpers/webhooks/editWebhookMessage.ts b/helpers/webhooks/editWebhookMessage.ts index b7898c83a..05fb18bd5 100644 --- a/helpers/webhooks/editWebhookMessage.ts +++ b/helpers/webhooks/editWebhookMessage.ts @@ -13,7 +13,7 @@ export async function editWebhookMessage( ) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", options.messageId ? bot.constants.routes.WEBHOOK_MESSAGE(webhookId, webhookToken, options.messageId, options) : bot.constants.routes.WEBHOOK_MESSAGE_ORIGINAL(webhookId, webhookToken, options), diff --git a/helpers/webhooks/editWebhookWithToken.ts b/helpers/webhooks/editWebhookWithToken.ts index abebc0d94..5ceccac6b 100644 --- a/helpers/webhooks/editWebhookWithToken.ts +++ b/helpers/webhooks/editWebhookWithToken.ts @@ -11,7 +11,7 @@ export async function editWebhookWithToken( ) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.WEBHOOK(webhookId, webhookToken), { name: options.name, diff --git a/helpers/webhooks/getWebhook.ts b/helpers/webhooks/getWebhook.ts index cb7a644fa..bcb15e03d 100644 --- a/helpers/webhooks/getWebhook.ts +++ b/helpers/webhooks/getWebhook.ts @@ -5,7 +5,7 @@ import { DiscordWebhook } from "../../types/discord.ts"; export async function getWebhook(bot: Bot, webhookId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.WEBHOOK_ID(webhookId), ); diff --git a/helpers/webhooks/getWebhookMessage.ts b/helpers/webhooks/getWebhookMessage.ts index f8b952db1..4b0b4e828 100644 --- a/helpers/webhooks/getWebhookMessage.ts +++ b/helpers/webhooks/getWebhookMessage.ts @@ -15,7 +15,7 @@ export async function getWebhookMessage( ) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.WEBHOOK_MESSAGE(webhookId, webhookToken, messageId, options), ); diff --git a/helpers/webhooks/getWebhookWithToken.ts b/helpers/webhooks/getWebhookWithToken.ts index 92f7b2f68..e5a9d3500 100644 --- a/helpers/webhooks/getWebhookWithToken.ts +++ b/helpers/webhooks/getWebhookWithToken.ts @@ -5,7 +5,7 @@ import { DiscordWebhook } from "../../types/discord.ts"; export async function getWebhookWithToken(bot: Bot, webhookId: bigint, token: string) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.WEBHOOK(webhookId, token), ); diff --git a/helpers/webhooks/getWebhooks.ts b/helpers/webhooks/getWebhooks.ts index 2487a2d21..d58889ec1 100644 --- a/helpers/webhooks/getWebhooks.ts +++ b/helpers/webhooks/getWebhooks.ts @@ -6,7 +6,7 @@ import { Collection } from "../../util/collection.ts"; export async function getWebhooks(bot: Bot, guildId: bigint) { const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_WEBHOOKS(guildId), ); diff --git a/helpers/webhooks/sendWebhook.ts b/helpers/webhooks/sendWebhook.ts index a97febb91..fcd1fe8dc 100644 --- a/helpers/webhooks/sendWebhook.ts +++ b/helpers/webhooks/sendWebhook.ts @@ -16,7 +16,7 @@ export async function sendWebhook(bot: Bot, webhookId: bigint, webhookToken: str const result = await bot.rest.runMethod( bot.rest, - "post", + "POST", bot.constants.routes.WEBHOOK(webhookId, webhookToken, options), { wait: options.wait, diff --git a/plugins/helpers/src/getMembersPaginated.ts b/plugins/helpers/src/getMembersPaginated.ts index 8449859b6..ae4a989f5 100644 --- a/plugins/helpers/src/getMembersPaginated.ts +++ b/plugins/helpers/src/getMembersPaginated.ts @@ -32,7 +32,7 @@ export async function getMembersPaginated( const result = await bot.rest.runMethod( bot.rest, - "get", + "GET", bot.constants.routes.GUILD_MEMBERS(guildId, { limit: membersLeft > 1000 ? 1000 : membersLeft, after: options.after, diff --git a/plugins/helpers/src/suppressEmbeds.ts b/plugins/helpers/src/suppressEmbeds.ts index cac616909..3e046f7a3 100644 --- a/plugins/helpers/src/suppressEmbeds.ts +++ b/plugins/helpers/src/suppressEmbeds.ts @@ -8,7 +8,7 @@ export async function suppressEmbeds( ) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.CHANNEL_MESSAGE(channelId, messageId), { flags: 4 }, ); diff --git a/plugins/helpers/src/threads.ts b/plugins/helpers/src/threads.ts index fc83a7d17..40debc2ab 100644 --- a/plugins/helpers/src/threads.ts +++ b/plugins/helpers/src/threads.ts @@ -24,7 +24,7 @@ export async function unlockThread(bot: Bot, threadId: bigint) { export async function editThread(bot: Bot, threadId: bigint, options: ModifyThread, reason?: string) { const result = await bot.rest.runMethod( bot.rest, - "patch", + "PATCH", bot.constants.routes.CHANNEL(threadId), { name: options.name, diff --git a/rest/createRequestBody.ts b/rest/createRequestBody.ts index c4c34fe48..3fb36c27a 100644 --- a/rest/createRequestBody.ts +++ b/rest/createRequestBody.ts @@ -18,7 +18,7 @@ export function createRequestBody(rest: RestManager, queuedRequest: { request: R } // GET METHODS SHOULD NOT HAVE A BODY - if (queuedRequest.request.method.toUpperCase() === "GET") { + if (queuedRequest.request.method === "GET") { queuedRequest.payload.body = undefined; } @@ -53,6 +53,6 @@ export function createRequestBody(rest: RestManager, queuedRequest: { request: R return { headers, body: (queuedRequest.payload.body?.file ?? JSON.stringify(queuedRequest.payload.body)) as FormData | string, - method: queuedRequest.request.method.toUpperCase(), + method: queuedRequest.request.method, }; } diff --git a/rest/processQueue.ts b/rest/processQueue.ts index 18d7ebafe..92a4bb45a 100644 --- a/rest/processQueue.ts +++ b/rest/processQueue.ts @@ -12,7 +12,7 @@ export function processQueue(rest: RestManager, id: string) { // IF THIS DOESN'T HAVE ANY ITEMS JUST CANCEL, THE CLEANER WILL REMOVE IT. if (!queuedRequest) break; - const basicURL = rest.simplifyUrl(queuedRequest.request.url, queuedRequest.request.method.toUpperCase()); + const basicURL = rest.simplifyUrl(queuedRequest.request.url, queuedRequest.request.method); // IF THIS URL IS STILL RATE LIMITED, TRY AGAIN const urlResetIn = rest.checkRateLimits(rest, basicURL); diff --git a/rest/runMethod.ts b/rest/runMethod.ts index e48bca869..fffff04d5 100644 --- a/rest/runMethod.ts +++ b/rest/runMethod.ts @@ -4,7 +4,7 @@ import { RestRequestRejection, RestRequestResponse } from "./rest.ts"; export async function runMethod( rest: RestManager, - method: "get" | "post" | "put" | "delete" | "patch", + method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH", route: string, body?: unknown, options?: { @@ -35,7 +35,7 @@ export async function runMethod( Authorization: rest.secretKey, "Content-Type": "application/json", }, - method: method.toUpperCase(), + method, }).catch((error) => { errorStack.message = (error as Error)?.message; console.error(error); diff --git a/rest/runProxyMethod.ts b/rest/runProxyMethod.ts index f05c03b79..0adde9c92 100644 --- a/rest/runProxyMethod.ts +++ b/rest/runProxyMethod.ts @@ -7,7 +7,7 @@ export type ProxyMethodResponse = Omit( rest: RestManager, - method: "get" | "post" | "put" | "delete" | "patch", + method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH", url: string, body?: unknown, retryCount = 0, diff --git a/site/docs/big-bot-guide/gateway.md b/site/docs/big-bot-guide/gateway.md index 76ed03a61..bfe92ba40 100644 --- a/site/docs/big-bot-guide/gateway.md +++ b/site/docs/big-bot-guide/gateway.md @@ -91,7 +91,7 @@ const rest = createRestManager({ }); // CALL THE REST PROCESS TO GET GATEWAY DATA -const result = await rest.runMethod(rest, "get", endpoints.GATEWAY_BOT).then((res) => ({ +const result = await rest.runMethod(rest, "GET", endpoints.GATEWAY_BOT).then((res) => ({ url: res.url, shards: res.shards, sessionStartLimit: { @@ -302,7 +302,7 @@ async function handleInteractionQueueing(gateway: GatewayManager, data: GatewayP if ([InteractionTypes.ModalSubmit, InteractionTypes.ApplicationCommandAutocomplete].includes(interaction.type)) { return await rest.runMethod( rest, - "post", + "POST", endpoints.INTERACTION_ID_TOKEN(BigInt(interaction.id), interaction.token), { type: InteractionResponseTypes.ChannelMessageWithSource, @@ -314,7 +314,7 @@ async function handleInteractionQueueing(gateway: GatewayManager, data: GatewayP ); } - await rest.runMethod(rest, "post", endpoints.INTERACTION_ID_TOKEN(BigInt(interaction.id), interaction.token), { + await rest.runMethod(rest, "POST", endpoints.INTERACTION_ID_TOKEN(BigInt(interaction.id), interaction.token), { // MESSAGE COMPONENTS NEED SPECIAL DEFER type: InteractionTypes.MessageComponent === interaction.type ? InteractionResponseTypes.DeferredUpdateMessage @@ -474,7 +474,7 @@ async function handleInteractionQueueing(gateway: GatewayManager, data: GatewayP if ([InteractionTypes.ModalSubmit, InteractionTypes.ApplicationCommandAutocomplete].includes(interaction.type)) { return await rest.runMethod( rest, - "post", + "POST", endpoints.INTERACTION_ID_TOKEN(BigInt(interaction.id), interaction.token), { type: InteractionResponseTypes.ChannelMessageWithSource, @@ -486,7 +486,7 @@ async function handleInteractionQueueing(gateway: GatewayManager, data: GatewayP ); } - await rest.runMethod(rest, "post", endpoints.INTERACTION_ID_TOKEN(BigInt(interaction.id), interaction.token), { + await rest.runMethod(rest, "POST", endpoints.INTERACTION_ID_TOKEN(BigInt(interaction.id), interaction.token), { // MESSAGE COMPONENTS NEED SPECIAL DEFER type: InteractionTypes.MessageComponent === interaction.type ? InteractionResponseTypes.DeferredUpdateMessage