Class commands, improved sharding, and many other changes (#88)
* Load commands recursively
* Sort commands
* Missed a couple of spots
* missed even more spots apparently
* Ported commands in "fun" category to new class-based format, added babel eslint plugin
* Ported general commands, removed old/unneeded stuff, replaced moment with day, many more fixes I lost track of
* Missed a spot
* Removed unnecessary abort-controller package, add deprecation warning for mongo database
* Added imagereload, clarified premature end message
* Fixed docker-compose path issue, added total bot uptime to stats, more fixes for various parts
* Converted image commands into classes, fixed reload, ignore another WS event, cleaned up command handler and image runner
* Converted music/soundboard commands to class format
* Cleanup unnecessary logs
* awful tag command class port
* I literally somehow just learned that you can leave out the constructor in classes
* Pass client directly to commands/events, cleaned up command handler
* Migrated bot to eris-sharder, fixed some error handling stuff
* Remove unused modules
* Fixed type returning
* Switched back to Eris stable
* Some fixes and cleanup
* might wanna correct this
* Implement image command ratelimiting
* Added Bot token prefix, added imagestats, added running endpoint to API
2021-04-12 16:16:12 +00:00
|
|
|
class Command {
|
2022-03-22 20:43:26 +00:00
|
|
|
constructor(client, cluster, worker, ipc, options) {
|
Class commands, improved sharding, and many other changes (#88)
* Load commands recursively
* Sort commands
* Missed a couple of spots
* missed even more spots apparently
* Ported commands in "fun" category to new class-based format, added babel eslint plugin
* Ported general commands, removed old/unneeded stuff, replaced moment with day, many more fixes I lost track of
* Missed a spot
* Removed unnecessary abort-controller package, add deprecation warning for mongo database
* Added imagereload, clarified premature end message
* Fixed docker-compose path issue, added total bot uptime to stats, more fixes for various parts
* Converted image commands into classes, fixed reload, ignore another WS event, cleaned up command handler and image runner
* Converted music/soundboard commands to class format
* Cleanup unnecessary logs
* awful tag command class port
* I literally somehow just learned that you can leave out the constructor in classes
* Pass client directly to commands/events, cleaned up command handler
* Migrated bot to eris-sharder, fixed some error handling stuff
* Remove unused modules
* Fixed type returning
* Switched back to Eris stable
* Some fixes and cleanup
* might wanna correct this
* Implement image command ratelimiting
* Added Bot token prefix, added imagestats, added running endpoint to API
2021-04-12 16:16:12 +00:00
|
|
|
this.client = client;
|
2021-04-29 21:56:32 +00:00
|
|
|
this.cluster = cluster;
|
2021-07-05 04:15:27 +00:00
|
|
|
this.worker = worker;
|
2021-04-29 21:56:32 +00:00
|
|
|
this.ipc = ipc;
|
2022-04-05 03:05:28 +00:00
|
|
|
this.origOptions = options;
|
2022-03-22 20:43:26 +00:00
|
|
|
this.type = options.type;
|
|
|
|
this.args = options.args;
|
|
|
|
if (options.type === "classic") {
|
|
|
|
this.message = options.message;
|
2022-03-31 05:42:03 +00:00
|
|
|
this.channel = options.message.channel;
|
|
|
|
this.author = options.message.author;
|
2022-04-05 03:05:28 +00:00
|
|
|
this.member = options.message.member;
|
2022-03-22 20:43:26 +00:00
|
|
|
this.content = options.content;
|
2022-06-25 03:03:34 +00:00
|
|
|
this.options = options.specialArgs;
|
2022-03-22 20:43:26 +00:00
|
|
|
this.reference = {
|
|
|
|
messageReference: {
|
2022-03-31 05:42:03 +00:00
|
|
|
channelID: this.channel.id,
|
2022-03-22 20:43:26 +00:00
|
|
|
messageID: this.message.id,
|
2022-03-31 05:42:03 +00:00
|
|
|
guildID: this.channel.guild ? this.channel.guild.id : undefined,
|
2022-03-22 20:43:26 +00:00
|
|
|
failIfNotExists: false
|
|
|
|
},
|
|
|
|
allowedMentions: {
|
|
|
|
repliedUser: false
|
|
|
|
}
|
|
|
|
};
|
2022-03-31 05:42:03 +00:00
|
|
|
} else if (options.type === "application") {
|
2022-03-22 20:43:26 +00:00
|
|
|
this.interaction = options.interaction;
|
2022-06-07 23:26:40 +00:00
|
|
|
this.args = [];
|
2022-03-31 05:42:03 +00:00
|
|
|
this.channel = options.interaction.channel;
|
2022-04-05 03:05:28 +00:00
|
|
|
this.author = this.member = options.interaction.guildID ? options.interaction.member : options.interaction.user;
|
2022-03-31 05:42:03 +00:00
|
|
|
if (options.interaction.data.options) {
|
2022-06-25 03:03:34 +00:00
|
|
|
this.options = options.interaction.data.options.reduce((obj, item) => {
|
2022-03-31 05:42:03 +00:00
|
|
|
obj[item.name] = item.value;
|
|
|
|
return obj;
|
|
|
|
}, {});
|
2022-04-05 03:05:28 +00:00
|
|
|
this.optionsArray = options.interaction.data.options;
|
2022-03-31 05:42:03 +00:00
|
|
|
} else {
|
2022-06-25 03:03:34 +00:00
|
|
|
this.options = {};
|
2022-03-31 05:42:03 +00:00
|
|
|
}
|
2022-03-22 20:43:26 +00:00
|
|
|
}
|
Class commands, improved sharding, and many other changes (#88)
* Load commands recursively
* Sort commands
* Missed a couple of spots
* missed even more spots apparently
* Ported commands in "fun" category to new class-based format, added babel eslint plugin
* Ported general commands, removed old/unneeded stuff, replaced moment with day, many more fixes I lost track of
* Missed a spot
* Removed unnecessary abort-controller package, add deprecation warning for mongo database
* Added imagereload, clarified premature end message
* Fixed docker-compose path issue, added total bot uptime to stats, more fixes for various parts
* Converted image commands into classes, fixed reload, ignore another WS event, cleaned up command handler and image runner
* Converted music/soundboard commands to class format
* Cleanup unnecessary logs
* awful tag command class port
* I literally somehow just learned that you can leave out the constructor in classes
* Pass client directly to commands/events, cleaned up command handler
* Migrated bot to eris-sharder, fixed some error handling stuff
* Remove unused modules
* Fixed type returning
* Switched back to Eris stable
* Some fixes and cleanup
* might wanna correct this
* Implement image command ratelimiting
* Added Bot token prefix, added imagestats, added running endpoint to API
2021-04-12 16:16:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async run() {
|
|
|
|
return "It works!";
|
|
|
|
}
|
|
|
|
|
2022-03-22 20:43:26 +00:00
|
|
|
async acknowledge() {
|
|
|
|
if (this.type === "classic") {
|
2022-03-31 05:42:03 +00:00
|
|
|
await this.client.sendChannelTyping(this.channel.id);
|
2022-03-22 20:43:26 +00:00
|
|
|
} else {
|
|
|
|
await this.interaction.acknowledge();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-05 03:05:28 +00:00
|
|
|
static init() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
Class commands, improved sharding, and many other changes (#88)
* Load commands recursively
* Sort commands
* Missed a couple of spots
* missed even more spots apparently
* Ported commands in "fun" category to new class-based format, added babel eslint plugin
* Ported general commands, removed old/unneeded stuff, replaced moment with day, many more fixes I lost track of
* Missed a spot
* Removed unnecessary abort-controller package, add deprecation warning for mongo database
* Added imagereload, clarified premature end message
* Fixed docker-compose path issue, added total bot uptime to stats, more fixes for various parts
* Converted image commands into classes, fixed reload, ignore another WS event, cleaned up command handler and image runner
* Converted music/soundboard commands to class format
* Cleanup unnecessary logs
* awful tag command class port
* I literally somehow just learned that you can leave out the constructor in classes
* Pass client directly to commands/events, cleaned up command handler
* Migrated bot to eris-sharder, fixed some error handling stuff
* Remove unused modules
* Fixed type returning
* Switched back to Eris stable
* Some fixes and cleanup
* might wanna correct this
* Implement image command ratelimiting
* Added Bot token prefix, added imagestats, added running endpoint to API
2021-04-12 16:16:12 +00:00
|
|
|
static description = "No description found";
|
|
|
|
static aliases = [];
|
|
|
|
static arguments = [];
|
2021-07-14 22:23:50 +00:00
|
|
|
static flags = [];
|
Class commands, improved sharding, and many other changes (#88)
* Load commands recursively
* Sort commands
* Missed a couple of spots
* missed even more spots apparently
* Ported commands in "fun" category to new class-based format, added babel eslint plugin
* Ported general commands, removed old/unneeded stuff, replaced moment with day, many more fixes I lost track of
* Missed a spot
* Removed unnecessary abort-controller package, add deprecation warning for mongo database
* Added imagereload, clarified premature end message
* Fixed docker-compose path issue, added total bot uptime to stats, more fixes for various parts
* Converted image commands into classes, fixed reload, ignore another WS event, cleaned up command handler and image runner
* Converted music/soundboard commands to class format
* Cleanup unnecessary logs
* awful tag command class port
* I literally somehow just learned that you can leave out the constructor in classes
* Pass client directly to commands/events, cleaned up command handler
* Migrated bot to eris-sharder, fixed some error handling stuff
* Remove unused modules
* Fixed type returning
* Switched back to Eris stable
* Some fixes and cleanup
* might wanna correct this
* Implement image command ratelimiting
* Added Bot token prefix, added imagestats, added running endpoint to API
2021-04-12 16:16:12 +00:00
|
|
|
static requires = [];
|
2022-03-22 20:43:26 +00:00
|
|
|
static slashAllowed = true;
|
2022-06-28 21:15:31 +00:00
|
|
|
static directAllowed = true;
|
Class commands, improved sharding, and many other changes (#88)
* Load commands recursively
* Sort commands
* Missed a couple of spots
* missed even more spots apparently
* Ported commands in "fun" category to new class-based format, added babel eslint plugin
* Ported general commands, removed old/unneeded stuff, replaced moment with day, many more fixes I lost track of
* Missed a spot
* Removed unnecessary abort-controller package, add deprecation warning for mongo database
* Added imagereload, clarified premature end message
* Fixed docker-compose path issue, added total bot uptime to stats, more fixes for various parts
* Converted image commands into classes, fixed reload, ignore another WS event, cleaned up command handler and image runner
* Converted music/soundboard commands to class format
* Cleanup unnecessary logs
* awful tag command class port
* I literally somehow just learned that you can leave out the constructor in classes
* Pass client directly to commands/events, cleaned up command handler
* Migrated bot to eris-sharder, fixed some error handling stuff
* Remove unused modules
* Fixed type returning
* Switched back to Eris stable
* Some fixes and cleanup
* might wanna correct this
* Implement image command ratelimiting
* Added Bot token prefix, added imagestats, added running endpoint to API
2021-04-12 16:16:12 +00:00
|
|
|
}
|
|
|
|
|
2021-08-19 14:19:14 +00:00
|
|
|
export default Command;
|