Archived
changed toCommandObject method
This commit is contained in:
1 parent
8fe02ab2dc
commit
5b08cb3fc6
2 files changed
+4
-4
No files matched your search
+3
-3
@@ -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());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
+1
-1
@@ -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) => {
|
||||
|
||||
Reference in new issue
Block a user