Update upsert_slash_commands.ts

This commit is contained in:
ITOH
2021-04-23 23:31:38 +02:00
parent 7ee20b0b3e
commit 5451c1ad95
@@ -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";
@@ -15,13 +16,11 @@ export async function upsertSlashCommands(
) { ) {
validateSlashCommands(options); validateSlashCommands(options);
const result = await rest.runMethod( return await rest.runMethod<ApplicationCommand[]>(
"put", "put",
guildId guildId
? endpoints.COMMANDS_GUILD(applicationId, guildId) ? endpoints.COMMANDS_GUILD(applicationId, guildId)
: endpoints.COMMANDS(applicationId), : endpoints.COMMANDS(applicationId),
options, options,
); );
return result;
} }