From 5b08cb3fc63e96715d8dda47e7b1446fa3714207 Mon Sep 17 00:00:00 2001 From: GRZ4NA Date: Sat, 4 Sep 2021 01:25:56 +0200 Subject: [PATCH] changed toCommandObject method --- src/Bot.ts | 6 +++--- src/Command.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bot.ts b/src/Bot.ts index c315b63..f019e1a 100644 --- a/src/Bot.ts +++ b/src/Bot.ts @@ -251,7 +251,7 @@ export class Bot extends EventEmitter { process.stdout.write("Registering commands... "); await axios.put( `https://discord.com/api/v8/applications/${this.applicationId}/commands`, - this.commands.list.filter((c) => !Array.isArray(c.guilds) && c.slash).map((c) => c.toCommandObject()), + this.commands.list.filter((c) => !Array.isArray(c.guilds) && c.slash).map((c) => c.toObject()), { headers: { Authorization: `Bot ${this.token}` } } ); const guilds: any = {}; @@ -263,10 +263,10 @@ export class Bot extends EventEmitter { throw new Error(`"${g}" for "${c.name}" command is not a valid guild ID`); } if (guilds[g]) { - guilds[g].push(c.toCommandObject()); + guilds[g].push(c.toObject()); } else { guilds[g] = []; - guilds[g].push(c.toCommandObject()); + guilds[g].push(c.toObject()); } }); }); diff --git a/src/Command.ts b/src/Command.ts index 1ac6332..2922b66 100644 --- a/src/Command.ts +++ b/src/Command.ts @@ -173,7 +173,7 @@ export class Command { * Converts {@link Command} instance to object that is recognized by the Discord API * @returns {Object} object */ - public toCommandObject() { + public toObject() { let options: any[] = []; if (this.parameters) { options = this.parameters.map((p) => {