Revert "restricted access to CommandManager's list"

This reverts commit 00753477de.
This commit is contained in:
mmacierzanka committed 2021-08-31 19:59:52 +02:00
1 parent 00753477de
commit 6bf657c3d2
3 files changed
+5 -17

No files matched your search

+3 -6
View File
@@ -132,6 +132,7 @@ export class Bot extends EventEmitter {
const helpMsg: Command = new HelpMessage(this.commands, this.messages.help, this.name);
this.commands.add(helpMsg);
}
Object.freeze(this.commands.list);
process.stdout.write("Connecting to Discord... ");
this.client.login(this.token);
this.client.on("ready", async () => {
@@ -247,15 +248,11 @@ export class Bot extends EventEmitter {
process.stdout.write("Registering commands... ");
await axios.put(
`https://discord.com/api/v8/applications/${this.applicationId}/commands`,
this.commands
.getList()
.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.toCommandObject()),
{ headers: { Authorization: `Bot ${this.token}` } }
);
const guilds: any = {};
await this.commands
.getList()
await this.commands.list
.filter((c) => Array.isArray(c.guilds) && c.guilds.length > 0)
.map((c) => {
c.guilds?.map(async (g) => {