Update upsert_slash_command.ts

This commit is contained in:
ITOH
2021-04-23 23:31:37 +02:00
parent 653e608d0e
commit 7ee20b0b3e
+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 { EditGlobalApplicationCommand } from "../../types/interactions/edit_global_application_command.ts"; import { EditGlobalApplicationCommand } from "../../types/interactions/edit_global_application_command.ts";
import { ApplicationCommand } from "../../types/mod.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { validateSlashCommands } from "../../util/utils.ts"; import { validateSlashCommands } from "../../util/utils.ts";
@@ -14,13 +15,11 @@ export async function upsertSlashCommand(
) { ) {
validateSlashCommands([options]); validateSlashCommands([options]);
const result = await rest.runMethod( return await rest.runMethod<ApplicationCommand>(
"patch", "patch",
guildId guildId
? endpoints.COMMANDS_GUILD_ID(applicationId, guildId, commandId) ? endpoints.COMMANDS_GUILD_ID(applicationId, guildId, commandId)
: endpoints.COMMANDS_ID(applicationId, commandId), : endpoints.COMMANDS_ID(applicationId, commandId),
options, options,
); );
return result;
} }