mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
Update create_slash_command.ts
This commit is contained in:
@@ -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;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user