mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-09-02 00:31:27 +03:00
Do things
This commit is contained in:
@@ -32,7 +32,7 @@ module.exports = class NewCommand extends Command {
|
||||
let settings = await guild.settings;
|
||||
const i18n = this.client.i18n.get(settings.locale);
|
||||
|
||||
channel.send(
|
||||
await channel.send(
|
||||
new MessageEmbed()
|
||||
.setColor(settings.colour)
|
||||
.setTitle(i18n('bot.version', require('../../package.json').version))
|
||||
|
@@ -86,6 +86,7 @@ const log = new Logger({
|
||||
const { selectPresence } = require('./utils/discord');
|
||||
const I18n = require('@eartharoid/i18n');
|
||||
const { CommandManager } = require('./modules/commands');
|
||||
const TicketManager = require('./modules/tickets');
|
||||
const { PluginManager } = require('./modules/plugins');
|
||||
|
||||
require('./modules/structures')(); // load extended structures before creating the client
|
||||
@@ -131,6 +132,9 @@ class Bot extends Client {
|
||||
require('./updater')(this); // check for updates
|
||||
require('./modules/listeners')(this); // load internal listeners
|
||||
|
||||
/** The ticket manager */
|
||||
this.tickets = new TicketManager(this);
|
||||
|
||||
/** The command manager, used by internal and plugin commands */
|
||||
this.commands = new CommandManager(this);
|
||||
|
||||
@@ -153,7 +157,7 @@ process.on('unhandledRejection', error => {
|
||||
log.notice('PLEASE INCLUDE THIS INFORMATION IF YOU ASK FOR HELP ABOUT THE FOLLOWING ERROR:');
|
||||
log.notice(`Discord Tickets v${version}, Node v${process.versions.node} on ${process.platform}`);
|
||||
log.warn('An error was not caught');
|
||||
if (error instanceof Error) log.warn(`Uncaught ${error.name}: ${error}`);
|
||||
if (error instanceof Error) log.warn(`Uncaught ${error.name}`);
|
||||
log.error(error);
|
||||
});
|
||||
|
||||
|
@@ -12,11 +12,11 @@ const Plugin = require('../plugins/plugin');
|
||||
*/
|
||||
module.exports = class Command {
|
||||
/**
|
||||
* A command option choice
|
||||
* @typedef CommandOptionChoice
|
||||
* A command option choice
|
||||
* @typedef CommandOptionChoice
|
||||
* @property {string} name - Choice name (1-100)
|
||||
* @property {(string|number)} value - choice value
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* A command option
|
||||
@@ -173,10 +173,11 @@ module.exports = class Command {
|
||||
* @param {*} content - Message content
|
||||
* @param {boolean} secret - Ephemeral message? **NOTE: EMBEDS AND ATTACHMENTS DO NOT RENDER IF TRUE**
|
||||
*/
|
||||
async sendResponse(interaction, content, secret) {
|
||||
const send = this.client.api.webhooks(this.client.fetchApplication().id, interaction.token).messages['@original'].patch;
|
||||
async respond(interaction, content, secret) {
|
||||
let application = await this.client.fetchApplication();
|
||||
const send = this.client.api.webhooks(application.id, interaction.token).messages['@original'].patch;
|
||||
if (typeof content === 'object')
|
||||
send({
|
||||
await send({
|
||||
data: {
|
||||
type: 4,
|
||||
data: {
|
||||
@@ -186,7 +187,7 @@ module.exports = class Command {
|
||||
}
|
||||
});
|
||||
else if (typeof content === 'string')
|
||||
send({
|
||||
await send({
|
||||
data: {
|
||||
type: 4,
|
||||
data: {
|
||||
@@ -196,20 +197,4 @@ module.exports = class Command {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit the original interaction response
|
||||
* @param {Interaction} interaction - Interaction object
|
||||
* @param {*} content - Message content
|
||||
*/
|
||||
async editResponse(interaction, content) {
|
||||
if (typeof content === 'object')
|
||||
this.client.api.interactions(interaction.id, interaction.token).messages.patch({
|
||||
embeds: content
|
||||
});
|
||||
else
|
||||
this.client.api.interactions(interaction.id, interaction.token).messages.patch({
|
||||
content
|
||||
});
|
||||
}
|
||||
};
|
@@ -7,7 +7,7 @@ const fs = require('fs');
|
||||
const { path } = require('../../utils/fs');
|
||||
|
||||
/**
|
||||
* Manages the loading of commands
|
||||
* Manages the loading and execution of commands
|
||||
*/
|
||||
module.exports = class CommandManager {
|
||||
/**
|
||||
|
Reference in New Issue
Block a user