Update create_slash_command.ts

This commit is contained in:
ITOH
2021-04-23 23:27:45 +02:00
parent e9a46f03cc
commit 36dc14523b
+2 -3
View File
@@ -1,6 +1,7 @@
import { applicationId } from "../../bot.ts"; import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../rest/rest.ts";
import { CreateGlobalApplicationCommand } from "../../types/interactions/create_global_application_command.ts"; import { CreateGlobalApplicationCommand } from "../../types/interactions/create_global_application_command.ts";
import { ApplicationCommand } from "../../types/mod.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { import {
camelKeysToSnakeCase, camelKeysToSnakeCase,
@@ -24,13 +25,11 @@ export async function createSlashCommand(
) { ) {
validateSlashCommands([options], true); validateSlashCommands([options], true);
const result = await rest.runMethod( return await rest.runMethod<ApplicationCommand>(
"post", "post",
guildId guildId
? endpoints.COMMANDS_GUILD(applicationId, guildId) ? endpoints.COMMANDS_GUILD(applicationId, guildId)
: endpoints.COMMANDS(applicationId), : endpoints.COMMANDS(applicationId),
camelKeysToSnakeCase(options), camelKeysToSnakeCase(options),
); );
return result;
} }