From b904a4ad3dafce6672fea555bfc208e7728b4d1c Mon Sep 17 00:00:00 2001 From: Isaac Date: Mon, 15 Mar 2021 21:12:58 +0000 Subject: [PATCH] things --- .github/CONTRIBUTING.md | 4 +- .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 2 +- README.md | 24 +++++------ src/banner.js | 2 +- src/commands/new.js | 13 +++--- src/database/index.js | 69 +++++++++++++++++++++++++++++++ src/index.js | 6 +-- src/locales/en-GB.json | 17 ++++++-- src/logger.js | 2 +- user/example.config.js | 4 +- 11 files changed, 113 insertions(+), 32 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 4c27b05..0998516 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -12,7 +12,7 @@ - [Website](#website) - [JSDoc](#jsdoc) -Thank you for considering contributing to DiscordTickets. +Thank you for considering contributing to Discord Tickets. Before contributing, please read the [code of conduct](CODE_OF_CONDUCT.md), which all contributors must follow. @@ -42,7 +42,7 @@ Please label your issues appropriately. - General questions (also on [Discord](https://go.eartharoid.me/discord)) - Requesting new features -Please read ["Welcome to DiscordTickets Discussions!"](https://github.com/discord-tickets/bot/discussions/77) before starting a discussion! +Please read ["Welcome to Discord Tickets Discussions!"](https://github.com/discord-tickets/bot/discussions/77) before starting a discussion! ## Submitting a bug report diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index d49c812..996dbf2 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -5,4 +5,4 @@ contact_links: about: Request new features, share ideas and guides, ask for help, or just talk. - name: Discord support server url: https://go.eartharoid.me/discord - about: The best place to go for help installing or using DiscordTickets + about: The best place to go for help installing or using Discord Tickets diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 9e58b30..0dec98b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,5 @@ diff --git a/README.md b/README.md index b0e6819..cf80d3f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -# [DiscordTickets](https://discordtickets.app) +# [Discord Tickets](https://discordtickets.app) [![GitHub stars](https://img.shields.io/github/stars/discord-tickets/bot?style=flat-square)](https://github.com/discord-tickets/bot/stargazers) [![GitHub forks](https://img.shields.io/github/forks/discord-tickets/bot?style=flat-square)](https://github.com/discord-tickets/bot/stargazers) @@ -22,21 +22,21 @@ An open-source ticket management bot for Discord - a free alternative to the pre ## What is this? -DiscordTickets is a Discord bot for creating and managing "support ticket" channels. It is a free and open-source alternative to the popular paid "premium" and "white-label" ticketing bots, such as [Ticket Tool](https://tickettool.xyz/), [TicketsBot](https://ticketsbot.net/), [Tickety](https://tickety.net/), [Helper.gg](https://helper.gg/), [Helper](https://helper.wtf), and others. +Discord Tickets is a Discord bot for creating and managing "support ticket" channels. It is a free and open-source alternative to the popular paid "premium" and "white-label" ticketing bots, such as [Ticket Tool](https://tickettool.xyz/), [TicketsBot](https://ticketsbot.net/), [Tickety](https://tickety.net/), [Helper.gg](https://helper.gg/), [Helper](https://helper.wtf), and others. -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. +Discord Tickets 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 you run more than one community. ### Features -DiscordTickets is packed full of features, many of which were suggested by its users. If it's missing a feature you want, you can: +Discord Tickets is packed full of features, many of which were suggested by its users. If it's missing a feature you want, you can: - Create a plugin for it, if you can code JavaScript - Request someone else to make a plugin - [Submit a feature request](https://github.com/discord-tickets/bot/blob/master/.github/CONTRIBUTING.md#submitting-a-feature-request) if you think many other users would benefit from it -Here's some of the things that makes DiscordTickets awesome: +Here's some of the things that makes Discord Tickets awesome: 1. **Highly customisable** Some messages can be configured for each server and for each ticket category. Every other message is set in the locale files, making it relatively easy to override the default messages. @@ -50,16 +50,16 @@ Plugin authors are encouraged to support multiple languages as well. Each ticket category has its own settings for messages and the support team roles. There's also multiple methods of creating a ticket. 4. **A beautiful ticket archives portal** -Add the official [DiscordTickets-Portal](https://github.com/discord-tickets/portal) plugin for an instant ticket archives website. +Add the official [Discord Tickets-Portal](https://github.com/discord-tickets/portal) plugin for an instant ticket archives website. 5. **Plugin support** -Developers can add a lot of functionality to DiscordTickets without modifying the source code by creating plugins. Plugins can listen for client and ticket events, create commands, and more. [DiscordTickets-Portal](https://github.com/discord-tickets/portal) is an example of what can be done with plugins. +Developers can add a lot of functionality to Discord Tickets without modifying the source code by creating plugins. Plugins can listen for client and ticket events, create commands, and more. [Discord Tickets-Portal](https://github.com/discord-tickets/portal) is an example of what can be done with plugins. 6. **Open-source and self-hosted** It's yours. 7. **Supports multiple databases** -DiscordTickets uses [Sequelize](https://github.com/sequelize/sequelize) to allow you to choose from SQLite, MySQL, MariaDB, PostgreSQL, or MSSQL for your database, with very little setup. +Discord Tickets uses [Sequelize](https://github.com/sequelize/sequelize) to allow you to choose from SQLite, MySQL, MariaDB, PostgreSQL, or MSSQL for your database, with very little setup. If you choose SQLite, which is the default as it is the easiest, you don't need to do anything! If you choose to use another database (recommended), you only need to install the package(s) with NPM and create the database. All of the database tables are created automatically, regardless of which database type you use. ### Screenshots @@ -91,7 +91,7 @@ For contributing instructions, or to find out all of the ways you can contribute ## Contributors -Thank you to everyone to has contributed to DiscordTickets, including everyone who has: +Thank you to everyone to has contributed to Discord Tickets, including everyone who has: - Contributed code - Translated @@ -106,7 +106,7 @@ Thank you to everyone to has contributed to DiscordTickets, including everyone w ## Sponsors -Does your community or company use DiscordTickets? Sponsor the project to get your logo shown here. +Does your community or company use Discord Tickets? Sponsor the project to get your logo shown here. ### Donate @@ -114,8 +114,8 @@ Does your community or company use DiscordTickets? Sponsor the project to get yo ## License -DiscordTickets is licensed under the [GPLv3 license](https://github.com/discord-tickets/bot/blob/master/LICENSE). +Discord Tickets is licensed under the [GPLv3 license](https://github.com/discord-tickets/bot/blob/master/LICENSE). -DiscordTickets is not related to Discord Inc. +Discord Tickets is not related to Discord Inc. © 2021 Isaac Saunders diff --git a/src/banner.js b/src/banner.js index 49139d7..6d01ad4 100644 --- a/src/banner.js +++ b/src/banner.js @@ -21,7 +21,7 @@ module.exports = () => { ## ## ## ## ## ## ## ## ## ## ## #### ###### ## ## ######## ## ###### `)); - console.log(leeks.colours.cyanBright(`DiscordTickets bot v${version} by eartharoid`)); + console.log(leeks.colours.cyanBright(`Discord Tickets bot v${version} by eartharoid`)); console.log(leeks.colours.cyanBright(homepage + '\n')); console.log(leeks.colours.cyanBright(`Please ${link('donate', 'https://ko-fi.com/eartharoid')} if you find this bot useful`)); console.log('\n\n'); diff --git a/src/commands/new.js b/src/commands/new.js index 2435be9..4f86e38 100644 --- a/src/commands/new.js +++ b/src/commands/new.js @@ -4,21 +4,22 @@ const Command = require('../modules/commands/command'); module.exports = class NewCommand extends Command { constructor(client) { + const i18n = client.i18n.get(); super(client, { internal: true, - name: 'new', - description: 'Create a new support ticket', + name: i18n('commands.new.name'), + description: i18n('commands.new.description'), options: [ // { - // name: 'category', + // name: i18n('commands.new.options.category.name'), // type: OptionTypes.STRING, - // description: 'The category you would like to create a new ticket for', + // description: i18n('commands.new.options.topic.description'), // required: true, // }, { - name: 'topic', + name: i18n('commands.new.options.topic.name'), type: OptionTypes.STRING, - description: 'The topic of the ticket', + description: i18n('commands.new.options.topic.description'), required: false, } ] diff --git a/src/database/index.js b/src/database/index.js index 90d8c6d..40fe228 100644 --- a/src/database/index.js +++ b/src/database/index.js @@ -173,6 +173,75 @@ module.exports = async (log) => { tableName: DB_TABLE_PREFIX + 'messages' }); + // eslint-disable-next-line no-unused-vars + const UserEntity = sequelize.define('UserEntity', { + user: { + type: DataTypes.CHAR(18), + allowNull: false, + unique: 'id_ticket' + }, + ticket: { + type: DataTypes.STRING, + allowNull: false, + unique: 'id_ticket', + references: { + model: Ticket, + key: 'id' + }, + }, + avatar: DataTypes.STRING, + username: DataTypes.STRING, + discriminator: DataTypes.STRING, + display_name: DataTypes.STRING, + colour: DataTypes.INTEGER, + bot: DataTypes.BOOLEAN + }, { + tableName: DB_TABLE_PREFIX + 'user_entities' + }); + + // eslint-disable-next-line no-unused-vars + const ChannelEntity = sequelize.define('ChannelEntity', { + channel: { + type: DataTypes.CHAR(18), + allowNull: false, + unique: 'id_ticket' + }, + ticket: { + type: DataTypes.STRING, + allowNull: false, + unique: 'id_ticket', + references: { + model: Ticket, + key: 'id' + }, + }, + name: DataTypes.STRING, + }, { + tableName: DB_TABLE_PREFIX + 'channel_entities' + }); + + // eslint-disable-next-line no-unused-vars + const RoleEntity = sequelize.define('RoleEntity', { + role: { + type: DataTypes.CHAR(18), + allowNull: false, + unique: 'id_ticket' + }, + ticket: { + type: DataTypes.STRING, + allowNull: false, + unique: 'id_ticket', + references: { + model: Ticket, + key: 'id' + }, + }, + name: DataTypes.STRING, + colour: DataTypes.INTEGER, + }, { + tableName: DB_TABLE_PREFIX + 'role_entities' + }); + sequelize.sync(); return sequelize; diff --git a/src/index.js b/src/index.js index 55a3588..3fbc0a6 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ /** - * DiscordTickets + * Discord Tickets * Copyright (C) 2021 Isaac Saunders * * This program is free software: you can redistribute it and/or modify @@ -23,7 +23,7 @@ const node_version = Number(process.versions.node.split('.')[0]); if (node_version < 14) - return console.log(`Error: DiscordTickets does not work on Node v${node_version}. Please upgrade to v14 or above.`); + return console.log(`Error: Discord Tickets does not work on Node v${node_version}. Please upgrade to v14 or above.`); const fs = require('fs'); const { path } = require('./utils/fs'); @@ -130,7 +130,7 @@ class Bot extends Client { async postStats() { /** * OH NO, TELEMETRY!? - * Relax, it just counts how many people are using DiscordTickets. + * Relax, it just counts how many people are using Discord Tickets. * You can see the source here: https://github.com/discord-tickets/stats */ if (this.config.super_secret_setting) { // you can disable it if you really want diff --git a/src/locales/en-GB.json b/src/locales/en-GB.json index f8aae76..00db934 100644 --- a/src/locales/en-GB.json +++ b/src/locales/en-GB.json @@ -1,11 +1,22 @@ { "admin_only": "❌ You must be an administrator to use this command.", "bot": { - "version": "DiscordTickets v%s by eartharoid" + "version": "Discord Tickets v%s by eartharoid" }, - "cmd": { + "commands": { "new": { - + "name": "new", + "description": "Create a new support ticket", + "options": { + "category": { + "name": "category", + "description": "The category you would like to create a new ticket for" + }, + "topic": { + "name": "topic", + "description": "The topic of the ticket" + } + } } }, "no_perm": "❌ You do not have the permissions required to use this command:\n%s", diff --git a/src/logger.js b/src/logger.js index b278a74..e344add 100644 --- a/src/logger.js +++ b/src/logger.js @@ -2,7 +2,7 @@ const { path } = require('./utils/fs'); const config = require('../user/config'); const Logger = require('leekslazylogger-fastify'); module.exports = new Logger({ - name: 'DiscordTickets by eartharoid', + name: 'Discord Tickets by eartharoid', debug: config.debug, logToFile: config.logs.enabled, splitFile: true, diff --git a/user/example.config.js b/user/example.config.js index 9a82f7d..f4bc5f1 100644 --- a/user/example.config.js +++ b/user/example.config.js @@ -26,8 +26,8 @@ module.exports = { debug: false, defaults: { colour: '#009999', - locale: 'en-GB', - log_messages: true, // required for transcripts/archives + locale: 'en-GB', // can **not** be set for each server + log_messages: true, // transcripts/archives will be empty if false prefix: '-', ticket_welcome: 'Hello {{name}}, thank you for creating a ticket. A member of staff will soon be available to assist you.\n\n__All messages in this channel are stored for future reference.__', },