Do things

This commit is contained in:
Isaac 2021-02-25 09:58:19 +00:00
parent 653d9dd464
commit a0b1853bff
No known key found for this signature in database
GPG Key ID: 279D1F53391CED07
7 changed files with 22 additions and 37 deletions

View File

@ -26,7 +26,7 @@ DiscordTickets is a Discord bot for creating and managing "support ticket" chann
DiscordTickets is feature-rich and much more customisable than many of the bots mentioned above. As it is intended for self-hosting, the bot can have your community or company's logo, for free. DiscordTickets is feature-rich and much more customisable than many of the bots mentioned above. As it is intended for self-hosting, the bot can have your community or company's logo, for free.
Although intended for use in a single Discord server, the bot can also function in multiple servers at once if run more than one community. Although intended for use in a single Discord server, the bot can also function in multiple servers at once if you run more than one community.
### Features ### Features
@ -91,20 +91,16 @@ For contributing instructions, or to find out all of the ways you can contribute
## Contributors ## Contributors
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](https://github.com/eartharoid/DiscordTickets/blob/master/CONTRIBUTORS.md)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
Thank you to everyone to has contributed to DiscordTickets, including everyone who has: Thank you to everyone to has contributed to DiscordTickets, including everyone who has:
- Contributed code - Contributed code
- Translated - Translated
- Improved documentation - Improved documentation
- Supported and helped others
- Created resources such as tutorials
- Created a public plugin
- Reported bugs - Reported bugs
- Requested a feature - Requested a feature
- Given help or support to other users
- Created a public plugin
- Created resources such as tutorials
**A full list of contributors can be found in [CONTRIBUTORS.md](https://github.com/eartharoid/DiscordTickets/blob/master/CONTRIBUTORS.md).** **A full list of contributors can be found in [CONTRIBUTORS.md](https://github.com/eartharoid/DiscordTickets/blob/master/CONTRIBUTORS.md).**

View File

@ -32,7 +32,7 @@ module.exports = class NewCommand extends Command {
let settings = await guild.settings; let settings = await guild.settings;
const i18n = this.client.i18n.get(settings.locale); const i18n = this.client.i18n.get(settings.locale);
channel.send( await channel.send(
new MessageEmbed() new MessageEmbed()
.setColor(settings.colour) .setColor(settings.colour)
.setTitle(i18n('bot.version', require('../../package.json').version)) .setTitle(i18n('bot.version', require('../../package.json').version))

View File

@ -86,6 +86,7 @@ const log = new Logger({
const { selectPresence } = require('./utils/discord'); const { selectPresence } = require('./utils/discord');
const I18n = require('@eartharoid/i18n'); const I18n = require('@eartharoid/i18n');
const { CommandManager } = require('./modules/commands'); const { CommandManager } = require('./modules/commands');
const TicketManager = require('./modules/tickets');
const { PluginManager } = require('./modules/plugins'); const { PluginManager } = require('./modules/plugins');
require('./modules/structures')(); // load extended structures before creating the client 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('./updater')(this); // check for updates
require('./modules/listeners')(this); // load internal listeners require('./modules/listeners')(this); // load internal listeners
/** The ticket manager */
this.tickets = new TicketManager(this);
/** The command manager, used by internal and plugin commands */ /** The command manager, used by internal and plugin commands */
this.commands = new CommandManager(this); 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('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.notice(`Discord Tickets v${version}, Node v${process.versions.node} on ${process.platform}`);
log.warn('An error was not caught'); 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); log.error(error);
}); });

View File

@ -173,10 +173,11 @@ module.exports = class Command {
* @param {*} content - Message content * @param {*} content - Message content
* @param {boolean} secret - Ephemeral message? **NOTE: EMBEDS AND ATTACHMENTS DO NOT RENDER IF TRUE** * @param {boolean} secret - Ephemeral message? **NOTE: EMBEDS AND ATTACHMENTS DO NOT RENDER IF TRUE**
*/ */
async sendResponse(interaction, content, secret) { async respond(interaction, content, secret) {
const send = this.client.api.webhooks(this.client.fetchApplication().id, interaction.token).messages['@original'].patch; let application = await this.client.fetchApplication();
const send = this.client.api.webhooks(application.id, interaction.token).messages['@original'].patch;
if (typeof content === 'object') if (typeof content === 'object')
send({ await send({
data: { data: {
type: 4, type: 4,
data: { data: {
@ -186,7 +187,7 @@ module.exports = class Command {
} }
}); });
else if (typeof content === 'string') else if (typeof content === 'string')
send({ await send({
data: { data: {
type: 4, type: 4,
data: { 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
});
}
}; };

View File

@ -7,7 +7,7 @@ const fs = require('fs');
const { path } = require('../../utils/fs'); const { path } = require('../../utils/fs');
/** /**
* Manages the loading of commands * Manages the loading and execution of commands
*/ */
module.exports = class CommandManager { module.exports = class CommandManager {
/** /**

View File

@ -41,16 +41,16 @@ module.exports = {
presence: { presence: {
presences: [ presences: [
{ {
activity: '/new | /help', activity: '/new',
type: 'PLAYING', type: 'PLAYING',
status: 'online' status: 'online'
}, },
{ {
activity: 'with tickets | /help', activity: 'with tickets',
type: 'PLAYING' type: 'PLAYING'
}, },
{ {
activity: 'for new tickets | /help', activity: 'for new tickets',
type: 'WATCHING' type: 'WATCHING'
}, },
/* { // an example /* { // an example