mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 00:40:07 +00:00
perf(plugins/helpers,rest,site,template)!: uppercase rest methods (#2252)
* perf(plugins/helpers,rest,site,template)!: uppercase rest methods There is no need for us to pass the methods in lower case and then use the `toUpperCase()` method everywhere. Therefore this PR changes every lowercase method to be uppercase (eg. `"get"` => `"GET"`). * template is old version
This commit is contained in:
@@ -10,7 +10,7 @@ export async function createChannel(bot: Bot, guildId: bigint, options?: CreateG
|
||||
|
||||
const result = await bot.rest.runMethod<DiscordChannel>(
|
||||
bot.rest,
|
||||
"post",
|
||||
"POST",
|
||||
bot.constants.routes.GUILD_CHANNELS(guildId),
|
||||
options
|
||||
? {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DiscordStageInstance } from "../../types/discord.ts";
|
||||
export async function createStageInstance(bot: Bot, options: CreateStageInstance) {
|
||||
const result = await bot.rest.runMethod<DiscordStageInstance>(
|
||||
bot.rest,
|
||||
"post",
|
||||
"POST",
|
||||
bot.constants.routes.STAGE_INSTANCES(),
|
||||
{
|
||||
channel_id: options.channelId.toString(),
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DiscordChannel } from "../../types/discord.ts";
|
||||
export async function deleteChannel(bot: Bot, channelId: bigint, reason?: string) {
|
||||
await bot.rest.runMethod<DiscordChannel>(
|
||||
bot.rest,
|
||||
"delete",
|
||||
"DELETE",
|
||||
bot.constants.routes.CHANNEL(channelId),
|
||||
{
|
||||
reason,
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { Bot } from "../../bot.ts";
|
||||
export async function deleteChannelOverwrite(bot: Bot, channelId: bigint, overwriteId: bigint) {
|
||||
await bot.rest.runMethod<undefined>(
|
||||
bot.rest,
|
||||
"delete",
|
||||
"DELETE",
|
||||
bot.constants.routes.CHANNEL_OVERWRITE(channelId, overwriteId),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export async function editChannel(bot: Bot, channelId: bigint, options: ModifyCh
|
||||
|
||||
const result = await bot.rest.runMethod<DiscordChannel>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
"PATCH",
|
||||
bot.constants.routes.CHANNEL(channelId),
|
||||
{
|
||||
name: options.name,
|
||||
|
||||
@@ -9,7 +9,7 @@ export async function editChannelOverwrite(
|
||||
) {
|
||||
await bot.rest.runMethod<undefined>(
|
||||
bot.rest,
|
||||
"put",
|
||||
"PUT",
|
||||
bot.constants.routes.CHANNEL_OVERWRITE(channelId, overwrite.id),
|
||||
{
|
||||
allow: overwrite.allow ? bot.utils.calculateBits(overwrite.allow) : "0",
|
||||
|
||||
@@ -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<DiscordFollowedChannel>(
|
||||
bot.rest,
|
||||
"post",
|
||||
"POST",
|
||||
bot.constants.routes.CHANNEL_FOLLOW(sourceChannelId),
|
||||
{
|
||||
webhook_channel_id: targetChannelId,
|
||||
|
||||
@@ -11,7 +11,7 @@ export async function createForumPost(
|
||||
) {
|
||||
const result = await bot.rest.runMethod<DiscordChannel>(
|
||||
bot.rest,
|
||||
"post",
|
||||
"POST",
|
||||
bot.constants.routes.FORUM_START(channelId),
|
||||
{
|
||||
name: options.name,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DiscordChannel } from "../../types/discord.ts";
|
||||
export async function getChannel(bot: Bot, channelId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordChannel>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.CHANNEL(channelId),
|
||||
);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { DiscordWebhook } from "../../types/discord.ts";
|
||||
export async function getChannelWebhooks(bot: Bot, channelId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordWebhook[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.CHANNEL_WEBHOOKS(channelId),
|
||||
);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { DiscordChannel } from "../../types/discord.ts";
|
||||
export async function getChannels(bot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordChannel[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_CHANNELS(guildId),
|
||||
);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DiscordMessage } from "../../types/discord.ts";
|
||||
export async function getPins(bot: Bot, channelId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordMessage[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.CHANNEL_PINS(channelId),
|
||||
);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DiscordStageInstance } from "../../types/discord.ts";
|
||||
export async function getStageInstance(bot: Bot, channelId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordStageInstance>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.STAGE_INSTANCE(channelId),
|
||||
);
|
||||
|
||||
|
||||
@@ -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<undefined>(bot.rest, "post", bot.constants.routes.CHANNEL_TYPING(channelId));
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "POST", bot.constants.routes.CHANNEL_TYPING(channelId));
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ export async function swapChannels(bot: Bot, guildId: bigint, channelPositions:
|
||||
|
||||
await bot.rest.runMethod<undefined>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
"PATCH",
|
||||
bot.constants.routes.GUILD_CHANNELS(guildId),
|
||||
channelPositions.map((channelPosition) => {
|
||||
return {
|
||||
|
||||
@@ -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<undefined>(bot.rest, "put", bot.constants.routes.THREAD_USER(threadId, userId));
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "PUT", bot.constants.routes.THREAD_USER(threadId, userId));
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Collection } from "../../../util/collection.ts";
|
||||
export async function getActiveThreads(bot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordListActiveThreads>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.THREAD_ACTIVE(guildId),
|
||||
);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ export async function getArchivedThreads(
|
||||
|
||||
const result = (await bot.rest.runMethod<DiscordListArchivedThreads>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
url,
|
||||
));
|
||||
|
||||
|
||||
@@ -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<DiscordThreadMember>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.THREAD_USER(threadId, userId),
|
||||
);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Collection } from "../../../util/collection.ts";
|
||||
export async function getThreadMembers(bot: Bot, threadId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordThreadMember[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.THREAD_MEMBERS(threadId),
|
||||
);
|
||||
// return result;
|
||||
|
||||
@@ -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<undefined>(bot.rest, "put", bot.constants.routes.THREAD_ME(threadId));
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "PUT", bot.constants.routes.THREAD_ME(threadId));
|
||||
}
|
||||
|
||||
@@ -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<undefined>(bot.rest, "delete", bot.constants.routes.THREAD_ME(threadId));
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "DELETE", bot.constants.routes.THREAD_ME(threadId));
|
||||
}
|
||||
|
||||
@@ -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<undefined>(bot.rest, "delete", bot.constants.routes.THREAD_USER(threadId, userId));
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "DELETE", bot.constants.routes.THREAD_USER(threadId, userId));
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export async function startThreadWithMessage(
|
||||
) {
|
||||
const result = await bot.rest.runMethod<DiscordChannel>(
|
||||
bot.rest,
|
||||
"post",
|
||||
"POST",
|
||||
bot.constants.routes.THREAD_START_PUBLIC(channelId, messageId),
|
||||
{
|
||||
name: options.name,
|
||||
|
||||
@@ -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<DiscordChannel>(
|
||||
bot.rest,
|
||||
"post",
|
||||
"POST",
|
||||
bot.constants.routes.THREAD_START_PRIVATE(channelId),
|
||||
{
|
||||
name: options.name,
|
||||
|
||||
@@ -10,7 +10,7 @@ export async function updateStageInstance(
|
||||
) {
|
||||
const result = await bot.rest.runMethod<DiscordStageInstance>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
"PATCH",
|
||||
bot.constants.routes.STAGE_INSTANCE(channelId),
|
||||
{
|
||||
topic: data.topic,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DiscordAddGuildDiscoverySubcategory } from "../../types/discord.ts";
|
||||
export async function addDiscoverySubcategory(bot: Bot, guildId: bigint, categoryId: number) {
|
||||
await bot.rest.runMethod<DiscordAddGuildDiscoverySubcategory>(
|
||||
bot.rest,
|
||||
"post",
|
||||
"POST",
|
||||
bot.constants.routes.DISCOVERY_SUBCATEGORY(guildId, categoryId),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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<DiscordDiscoveryMetadata>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
"PATCH",
|
||||
bot.constants.routes.DISCOVERY_METADATA(guildId),
|
||||
{
|
||||
primary_category_id: data.primaryCategoryId,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DiscordDiscoveryMetadata } from "../../types/discord.ts";
|
||||
export async function getDiscovery(bot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordDiscoveryMetadata>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.DISCOVERY_METADATA(guildId),
|
||||
);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { DiscordDiscoveryCategory } from "../../types/discord.ts";
|
||||
export async function getDiscoveryCategories(bot: Bot) {
|
||||
const result = await bot.rest.runMethod<DiscordDiscoveryCategory[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.DISCOVERY_CATEGORIES(),
|
||||
);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { Bot } from "../../bot.ts";
|
||||
export async function removeDiscoverySubcategory(bot: Bot, guildId: bigint, categoryId: number) {
|
||||
await bot.rest.runMethod<undefined>(
|
||||
bot.rest,
|
||||
"delete",
|
||||
"DELETE",
|
||||
bot.constants.routes.DISCOVERY_SUBCATEGORY(guildId, categoryId),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { DiscordValidateDiscoverySearchTerm } from "../../types/discord.ts";
|
||||
export async function validDiscoveryTerm(bot: Bot, term: string) {
|
||||
const result = await bot.rest.runMethod<DiscordValidateDiscoverySearchTerm>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.DISCOVERY_VALID_TERM(term),
|
||||
);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export async function createEmoji(bot: Bot, guildId: bigint, options: CreateGuil
|
||||
|
||||
const emoji = await bot.rest.runMethod<DiscordEmoji>(
|
||||
bot.rest,
|
||||
"post",
|
||||
"POST",
|
||||
bot.constants.routes.GUILD_EMOJIS(guildId),
|
||||
{
|
||||
name: options.name,
|
||||
|
||||
@@ -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<undefined>(bot.rest, "delete", bot.constants.routes.GUILD_EMOJI(guildId, id), {
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "DELETE", bot.constants.routes.GUILD_EMOJI(guildId, id), {
|
||||
reason,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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<DiscordEmoji>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
"PATCH",
|
||||
bot.constants.routes.GUILD_EMOJI(guildId, id),
|
||||
{
|
||||
name: options.name,
|
||||
|
||||
@@ -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<DiscordEmoji>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_EMOJI(guildId, emojiId),
|
||||
);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Collection } from "../../util/collection.ts";
|
||||
export async function getEmojis(bot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordEmoji[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_EMOJIS(guildId),
|
||||
);
|
||||
|
||||
|
||||
@@ -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<DiscordGuild>(bot.rest, "post", bot.constants.routes.GUILDS(), {
|
||||
const result = await bot.rest.runMethod<DiscordGuild>(bot.rest, "POST", bot.constants.routes.GUILDS(), {
|
||||
name: options.name,
|
||||
afk_channel_id: options.afkChannelId,
|
||||
afk_timeout: options.afkTimeout,
|
||||
|
||||
@@ -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<undefined>(bot.rest, "delete", bot.constants.routes.GUILD(guildId));
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "DELETE", bot.constants.routes.GUILD(guildId));
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export async function editGuild(bot: Bot, guildId: bigint, options: ModifyGuild,
|
||||
|
||||
const result = await bot.rest.runMethod<DiscordGuild>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
"PATCH",
|
||||
bot.constants.routes.GUILD(guildId),
|
||||
options,
|
||||
);
|
||||
|
||||
@@ -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<DiscordWelcomeScreen>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
"PATCH",
|
||||
bot.constants.routes.GUILD_WELCOME_SCREEN(guildId),
|
||||
{
|
||||
enabled: options.enabled,
|
||||
|
||||
@@ -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<DiscordGuildWidgetSettings>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
"PATCH",
|
||||
bot.constants.routes.GUILD_WIDGET(guildId),
|
||||
{
|
||||
enabled,
|
||||
|
||||
@@ -8,7 +8,7 @@ export async function getAuditLogs(bot: Bot, guildId: bigint, options?: GetGuild
|
||||
|
||||
const auditlog = await bot.rest.runMethod<DiscordAuditLog>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_AUDIT_LOGS(guildId, options),
|
||||
);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Collection } from "../../util/collection.ts";
|
||||
export async function getAvailableVoiceRegions(bot: Bot) {
|
||||
const result = await bot.rest.runMethod<DiscordVoiceRegion[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.VOICE_REGIONS(),
|
||||
);
|
||||
|
||||
|
||||
@@ -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<DiscordBan>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_BAN(guildId, memberId),
|
||||
);
|
||||
|
||||
|
||||
@@ -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<DiscordBan[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_BANS(guildId, options),
|
||||
);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export async function getGuild(
|
||||
) {
|
||||
const result = await bot.rest.runMethod<DiscordGuild>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD(guildId, options.counts),
|
||||
);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DiscordGuildPreview } from "../../types/discord.ts";
|
||||
export async function getGuildPreview(bot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordGuildPreview>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_PREVIEW(guildId),
|
||||
);
|
||||
|
||||
|
||||
@@ -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),
|
||||
);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DiscordInviteMetadata } from "../../types/discord.ts";
|
||||
export async function getVanityUrl(bot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<Partial<DiscordInviteMetadata>>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_VANITY_URL(guildId),
|
||||
);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { DiscordVoiceRegion } from "../../types/discord.ts";
|
||||
export async function getVoiceRegions(bot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordVoiceRegion[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_REGIONS(guildId),
|
||||
);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DiscordWelcomeScreen } from "../../types/discord.ts";
|
||||
export async function getWelcomeScreen(bot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordWelcomeScreen>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_WELCOME_SCREEN(guildId),
|
||||
);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DiscordGuildWidget } from "../../types/discord.ts";
|
||||
export async function getWidget(bot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordGuildWidget>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_WIDGET_JSON(guildId),
|
||||
);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DiscordGuildWidgetSettings } from "../../types/discord.ts";
|
||||
export async function getWidgetSettings(bot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordGuildWidgetSettings>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_WIDGET(guildId),
|
||||
);
|
||||
|
||||
|
||||
@@ -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<undefined>(bot.rest, "delete", bot.constants.routes.GUILD_LEAVE(guildId));
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "DELETE", bot.constants.routes.GUILD_LEAVE(guildId));
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export async function createScheduledEvent(bot: Bot, guildId: bigint, options: C
|
||||
|
||||
const event = await bot.rest.runMethod<DiscordScheduledEvent>(
|
||||
bot.rest,
|
||||
"post",
|
||||
"POST",
|
||||
bot.constants.routes.GUILD_SCHEDULED_EVENTS(guildId),
|
||||
{
|
||||
channel_id: options.channelId?.toString(),
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Bot } from "../../../bot.ts";
|
||||
export async function deleteScheduledEvent(bot: Bot, guildId: bigint, eventId: bigint) {
|
||||
await bot.rest.runMethod<undefined>(
|
||||
bot.rest,
|
||||
"delete",
|
||||
"DELETE",
|
||||
bot.constants.routes.GUILD_SCHEDULED_EVENT(guildId, eventId),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export async function editScheduledEvent(
|
||||
|
||||
const event = await bot.rest.runMethod<DiscordScheduledEvent>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
"PATCH",
|
||||
bot.constants.routes.GUILD_SCHEDULED_EVENT(guildId, eventId),
|
||||
{
|
||||
channel_id: options.channelId === null ? null : options.channelId?.toString(),
|
||||
|
||||
@@ -10,7 +10,7 @@ export async function getScheduledEvent(
|
||||
) {
|
||||
const event = await bot.rest.runMethod<DiscordScheduledEvent>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_SCHEDULED_EVENT(guildId, eventId, options?.withUserCount),
|
||||
);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ export async function getScheduledEventUsers(
|
||||
|
||||
const result = await bot.rest.runMethod<{ user: DiscordUser; member?: DiscordMember }[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
url,
|
||||
);
|
||||
|
||||
|
||||
@@ -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<DiscordScheduledEvent[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_SCHEDULED_EVENTS(guildId, options?.withUserCount),
|
||||
);
|
||||
|
||||
|
||||
@@ -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<undefined>(bot.rest, "delete", bot.constants.routes.GUILD_INTEGRATION(guildId, id));
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "DELETE", bot.constants.routes.GUILD_INTEGRATION(guildId, id));
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { DiscordIntegration } from "../../types/discord.ts";
|
||||
export async function getIntegrations(bot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordIntegration[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_INTEGRATIONS(guildId),
|
||||
);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ export async function createApplicationCommand(
|
||||
) {
|
||||
const result = await bot.rest.runMethod<DiscordApplicationCommand>(
|
||||
bot.rest,
|
||||
"post",
|
||||
"POST",
|
||||
guildId
|
||||
? bot.constants.routes.COMMANDS_GUILD(bot.applicationId, guildId)
|
||||
: bot.constants.routes.COMMANDS(bot.applicationId),
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { Bot } from "../../../bot.ts";
|
||||
export async function deleteApplicationCommand(bot: Bot, id: bigint, guildId?: bigint) {
|
||||
await bot.rest.runMethod<undefined>(
|
||||
bot.rest,
|
||||
"delete",
|
||||
"DELETE",
|
||||
guildId
|
||||
? bot.constants.routes.COMMANDS_GUILD_ID(bot.applicationId, guildId, id)
|
||||
: bot.constants.routes.COMMANDS_ID(bot.applicationId, id),
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { Bot } from "../../../bot.ts";
|
||||
export async function deleteInteractionResponse(bot: Bot, token: string, messageId?: bigint) {
|
||||
await bot.rest.runMethod<undefined>(
|
||||
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),
|
||||
|
||||
@@ -13,7 +13,7 @@ export async function editApplicationCommandPermissions(
|
||||
) {
|
||||
const result = await bot.rest.runMethod<DiscordGuildApplicationCommandPermissions>(
|
||||
bot.rest,
|
||||
"put",
|
||||
"PUT",
|
||||
bot.constants.routes.COMMANDS_PERMISSION(bot.applicationId, guildId, commandId),
|
||||
{
|
||||
permissions: options,
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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<DiscordApplicationCommand>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
options?.guildId
|
||||
? bot.constants.routes.COMMANDS_GUILD_ID(
|
||||
bot.applicationId,
|
||||
|
||||
@@ -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<DiscordGuildApplicationCommandPermissions>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.COMMANDS_PERMISSION(bot.applicationId, guildId, commandId),
|
||||
);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Collection } from "../../../util/collection.ts";
|
||||
export async function getApplicationCommandPermissions(bot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordGuildApplicationCommandPermissions[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.COMMANDS_PERMISSIONS(bot.applicationId, guildId),
|
||||
);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { DiscordApplicationCommand } from "../../../types/discord.ts";
|
||||
export async function getApplicationCommands(bot: Bot, guildId?: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordApplicationCommand[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
guildId
|
||||
? bot.constants.routes.COMMANDS_GUILD(bot.applicationId, guildId)
|
||||
: bot.constants.routes.COMMANDS(bot.applicationId),
|
||||
|
||||
@@ -19,7 +19,7 @@ export async function upsertApplicationCommand(
|
||||
) {
|
||||
const result = await bot.rest.runMethod<DiscordApplicationCommand>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
"PATCH",
|
||||
guildId
|
||||
? bot.constants.routes.COMMANDS_GUILD_ID(bot.applicationId, guildId, commandId)
|
||||
: bot.constants.routes.COMMANDS_ID(bot.applicationId, commandId),
|
||||
|
||||
@@ -21,7 +21,7 @@ export async function upsertApplicationCommands(
|
||||
) {
|
||||
const result = await bot.rest.runMethod<DiscordApplicationCommand[]>(
|
||||
bot.rest,
|
||||
"put",
|
||||
"PUT",
|
||||
guildId
|
||||
? bot.constants.routes.COMMANDS_GUILD(bot.applicationId, guildId)
|
||||
: bot.constants.routes.COMMANDS(bot.applicationId),
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Bot } from "../../../bot.ts";
|
||||
export async function deleteFollowupMessage(bot: Bot, interactionToken: string, messageId: bigint) {
|
||||
await bot.rest.runMethod<undefined>(
|
||||
bot.rest,
|
||||
"delete",
|
||||
"DELETE",
|
||||
bot.constants.routes.WEBHOOK_MESSAGE(bot.applicationId, interactionToken, messageId),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export async function editFollowupMessage(
|
||||
) {
|
||||
const result = await bot.rest.runMethod<DiscordMessage>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
"PATCH",
|
||||
bot.constants.routes.WEBHOOK_MESSAGE(bot.applicationId, interactionToken, messageId),
|
||||
{
|
||||
content: options.content,
|
||||
|
||||
@@ -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<DiscordMessage>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.WEBHOOK_MESSAGE(bot.applicationId, interactionToken, messageId),
|
||||
);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DiscordMessage } from "../../types/discord.ts";
|
||||
export async function getOriginalInteractionResponse(bot: Bot, token: string) {
|
||||
const result = await bot.rest.runMethod<DiscordMessage>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.INTERACTION_ORIGINAL_ID_TOKEN(bot.applicationId, token),
|
||||
);
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ export async function sendInteractionResponse(
|
||||
if (bot.cache.unrepliedInteractions.delete(id)) {
|
||||
return await bot.rest.runMethod<undefined>(
|
||||
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<DiscordMessage>(
|
||||
bot.rest,
|
||||
"post",
|
||||
"POST",
|
||||
bot.constants.routes.WEBHOOK(bot.applicationId, token),
|
||||
{ ...data, file: options.data.file },
|
||||
);
|
||||
|
||||
@@ -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<DiscordInvite>(
|
||||
bot.rest,
|
||||
"post",
|
||||
"POST",
|
||||
bot.constants.routes.CHANNEL_INVITES(channelId),
|
||||
{
|
||||
max_age: options.maxAge,
|
||||
|
||||
@@ -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<DiscordInviteMetadata>(bot.rest, "delete", bot.constants.routes.INVITE(inviteCode));
|
||||
await bot.rest.runMethod<DiscordInviteMetadata>(bot.rest, "DELETE", bot.constants.routes.INVITE(inviteCode));
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { DiscordInviteMetadata } from "../../types/discord.ts";
|
||||
export async function getChannelInvites(bot: Bot, channelId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordInviteMetadata[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.CHANNEL_INVITES(channelId),
|
||||
);
|
||||
|
||||
|
||||
@@ -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<DiscordInviteMetadata>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.INVITE(inviteCode, options),
|
||||
);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { DiscordInviteMetadata } from "../../types/discord.ts";
|
||||
export async function getInvites(bot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<DiscordInviteMetadata[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_INVITES(guildId),
|
||||
);
|
||||
|
||||
|
||||
@@ -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<undefined>(
|
||||
bot.rest,
|
||||
"put",
|
||||
"PUT",
|
||||
bot.constants.routes.GUILD_BAN(guildId, id),
|
||||
options
|
||||
? {
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
|
||||
@@ -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<DiscordMemberWithUser>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
"PATCH",
|
||||
bot.constants.routes.GUILD_MEMBER(guildId, memberId),
|
||||
{
|
||||
nick: options.nick,
|
||||
|
||||
@@ -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<DiscordChannel>(bot.rest, "post", bot.constants.routes.USER_DM(), {
|
||||
const dmChannelData = await bot.rest.runMethod<DiscordChannel>(bot.rest, "POST", bot.constants.routes.USER_DM(), {
|
||||
recipient_id: userId.toString(),
|
||||
});
|
||||
|
||||
|
||||
@@ -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<DiscordMemberWithUser>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_MEMBER(guildId, id),
|
||||
);
|
||||
|
||||
|
||||
@@ -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<DiscordMemberWithUser[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_MEMBERS(guildId, options),
|
||||
);
|
||||
|
||||
|
||||
@@ -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<undefined>(bot.rest, "delete", bot.constants.routes.GUILD_MEMBER(guildId, memberId), {
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "DELETE", bot.constants.routes.GUILD_MEMBER(guildId, memberId), {
|
||||
reason,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -22,7 +22,7 @@ export async function searchMembers(
|
||||
|
||||
const result = await bot.rest.runMethod<DiscordMemberWithUser[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
"GET",
|
||||
bot.constants.routes.GUILD_MEMBERS_SEARCH(guildId, query, options),
|
||||
);
|
||||
|
||||
|
||||
@@ -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<undefined>(bot.rest, "delete", bot.constants.routes.GUILD_BAN(guildId, id));
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "DELETE", bot.constants.routes.GUILD_BAN(guildId, id));
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export async function addReaction(bot: Bot, channelId: bigint, messageId: bigint
|
||||
|
||||
await bot.rest.runMethod<undefined>(
|
||||
bot.rest,
|
||||
"put",
|
||||
"PUT",
|
||||
bot.constants.routes.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, reaction),
|
||||
{},
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ export async function deleteMessage(
|
||||
|
||||
await bot.rest.runMethod<undefined>(
|
||||
bot.rest,
|
||||
"delete",
|
||||
"DELETE",
|
||||
bot.constants.routes.CHANNEL_MESSAGE(channelId, messageId),
|
||||
{ reason },
|
||||
);
|
||||
|
||||
@@ -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<undefined>(bot.rest, "post", bot.constants.routes.CHANNEL_BULK_DELETE(channelId), {
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "POST", bot.constants.routes.CHANNEL_BULK_DELETE(channelId), {
|
||||
messages: ids.splice(0, 100).map((id) => id.toString()),
|
||||
reason,
|
||||
});
|
||||
|
||||
@@ -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<DiscordMessage>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
"PATCH",
|
||||
bot.constants.routes.CHANNEL_MESSAGE(channelId, messageId),
|
||||
{
|
||||
content: content.content,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user