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-09-01 01:00:34 +00:00
|
|
|
success = true;
|
2022-09-21 05:05:03 +00:00
|
|
|
constructor(client, 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;
|
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;
|
2022-09-24 03:25:16 +00:00
|
|
|
this.guild = options.message.guild;
|
2022-03-31 05:42:03 +00:00
|
|
|
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-09-24 03:25:16 +00:00
|
|
|
channelID: this.message.channelID,
|
2022-03-22 20:43:26 +00:00
|
|
|
messageID: this.message.id,
|
2022-09-24 03:25:16 +00:00
|
|
|
guildID: this.message.guildID ?? 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-09-24 03:25:16 +00:00
|
|
|
this.guild = options.interaction.guild;
|
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-09-24 03:25:16 +00:00
|
|
|
this.options = options.interaction.data.options.raw.reduce((obj, item) => {
|
2022-03-31 05:42:03 +00:00
|
|
|
obj[item.name] = item.value;
|
|
|
|
return obj;
|
|
|
|
}, {});
|
2022-09-24 03:25:16 +00:00
|
|
|
this.optionsArray = options.interaction.data.options.raw;
|
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-09-24 03:25:16 +00:00
|
|
|
const channel = this.channel ?? await this.client.rest.channels.get(this.message.channelID);
|
|
|
|
await channel.sendTyping();
|
2022-09-21 05:05:03 +00:00
|
|
|
} else if (!this.interaction.acknowledged) {
|
2022-09-24 03:25:16 +00:00
|
|
|
await this.interaction.defer();
|
2022-03-22 20:43:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 = [];
|
2022-03-22 20:43:26 +00:00
|
|
|
static slashAllowed = true;
|
2022-06-28 21:15:31 +00:00
|
|
|
static directAllowed = true;
|
2022-09-01 15:40:55 +00:00
|
|
|
static adminOnly = false;
|
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;
|