diff --git a/src/helpers/interactions/commands/get_slash_command.ts b/src/helpers/interactions/commands/get_slash_command.ts index dafdf38ca..80b5fc3d6 100644 --- a/src/helpers/interactions/commands/get_slash_command.ts +++ b/src/helpers/interactions/commands/get_slash_command.ts @@ -1,14 +1,21 @@ import { applicationId } from "../../../bot.ts"; import { rest } from "../../../rest/rest.ts"; import type { ApplicationCommand } from "../../../types/interactions/commands/application_command.ts"; +import { snowflakeToBigint } from "../../../util/bigint.ts"; import { endpoints } from "../../../util/constants.ts"; /** Fetchs the global command for the given Id. If a guildId is provided, the guild command will be fetched. */ export async function getSlashCommand(commandId: bigint, guildId?: bigint) { - return await rest.runMethod( + const result = await rest.runMethod( "get", guildId ? endpoints.COMMANDS_GUILD_ID(applicationId, guildId, commandId) : endpoints.COMMANDS_ID(applicationId, commandId) ); + + return { + ...result, + id: snowflakeToBigint(result.id), + applicationId: snowflakeToBigint(result.applicationId), + }; } diff --git a/src/helpers/interactions/commands/get_slash_commands.ts b/src/helpers/interactions/commands/get_slash_commands.ts index a83d2e4dc..11cf8f6d4 100644 --- a/src/helpers/interactions/commands/get_slash_commands.ts +++ b/src/helpers/interactions/commands/get_slash_commands.ts @@ -1,6 +1,7 @@ import { applicationId } from "../../../bot.ts"; import { rest } from "../../../rest/rest.ts"; import type { ApplicationCommand } from "../../../types/interactions/commands/application_command.ts"; +import { snowflakeToBigint } from "../../../util/bigint.ts"; import { Collection } from "../../../util/collection.ts"; import { endpoints } from "../../../util/constants.ts"; @@ -11,5 +12,10 @@ export async function getSlashCommands(guildId?: bigint) { guildId ? endpoints.COMMANDS_GUILD(applicationId, guildId) : endpoints.COMMANDS(applicationId) ); - return new Collection(result.map((command) => [command.name, command])); + return new Collection( + result.map((command) => [ + command.name, + { ...command, id: snowflakeToBigint(command.id), applicationId: snowflakeToBigint(command.applicationId) }, + ]) + ); }