assign correct options

This commit is contained in:
ITOH
2021-05-23 11:58:09 +02:00
parent 411c85aed9
commit 815ccfc3f1
3 changed files with 3 additions and 3 deletions
@@ -17,7 +17,7 @@ import { snakelize, validateSlashCommands } from "../../../util/utils.ts";
* Guild commands update **instantly**. We recommend you use guild commands for quick testing, and global commands when they're ready for public use. * Guild commands update **instantly**. We recommend you use guild commands for quick testing, and global commands when they're ready for public use.
*/ */
export async function createSlashCommand(options: CreateGlobalApplicationCommand, guildId?: bigint) { export async function createSlashCommand(options: CreateGlobalApplicationCommand, guildId?: bigint) {
validateSlashCommands([options], true); [options] = validateSlashCommands([options], true) as CreateGlobalApplicationCommand[];
return await rest.runMethod<ApplicationCommand>( return await rest.runMethod<ApplicationCommand>(
"post", "post",
@@ -9,7 +9,7 @@ import { validateSlashCommands } from "../../../util/utils.ts";
* Edit an existing slash command. If this command did not exist, it will create it. * Edit an existing slash command. If this command did not exist, it will create it.
*/ */
export async function upsertSlashCommand(commandId: bigint, options: EditGlobalApplicationCommand, guildId?: bigint) { export async function upsertSlashCommand(commandId: bigint, options: EditGlobalApplicationCommand, guildId?: bigint) {
validateSlashCommands([options]); [options] = validateSlashCommands([options]);
return await rest.runMethod<ApplicationCommand>( return await rest.runMethod<ApplicationCommand>(
"patch", "patch",
@@ -11,7 +11,7 @@ import { validateSlashCommands } from "../../../util/utils.ts";
* **NOTE:** Any slash commands that are not specified in this function will be **deleted**. If you don't provide the commandId and rename your command, the command gets a new Id. * **NOTE:** Any slash commands that are not specified in this function will be **deleted**. If you don't provide the commandId and rename your command, the command gets a new Id.
*/ */
export async function upsertSlashCommands(options: EditGlobalApplicationCommand[], guildId?: bigint) { export async function upsertSlashCommands(options: EditGlobalApplicationCommand[], guildId?: bigint) {
validateSlashCommands(options); options = validateSlashCommands(options);
return await rest.runMethod<ApplicationCommand[]>( return await rest.runMethod<ApplicationCommand[]>(
"put", "put",