This commit is contained in:
Isaac 2021-03-15 21:12:58 +00:00
parent 96562aa474
commit b904a4ad3d
11 changed files with 113 additions and 32 deletions

View File

@ -12,7 +12,7 @@
- [Website](#website) - [Website](#website)
- [JSDoc](#jsdoc) - [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. 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)) - General questions (also on [Discord](https://go.eartharoid.me/discord))
- Requesting new features - 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 ## Submitting a bug report

View File

@ -5,4 +5,4 @@ contact_links:
about: Request new features, share ideas and guides, ask for help, or just talk. about: Request new features, share ideas and guides, ask for help, or just talk.
- name: Discord support server - name: Discord support server
url: https://go.eartharoid.me/discord 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

View File

@ -1,5 +1,5 @@
<!-- <!--
Thank you for contributing to DiscordTickets. Thank you for contributing to Discord Tickets.
If you haven't already, please read the CONTRIBUTING file (.github/CONTRIBUTING.md) before creating a pull request. If you haven't already, please read the CONTRIBUTING file (.github/CONTRIBUTING.md) before creating a pull request.
Unless this pull request is for something minor like a fixing a typo, you should create an issue first. Unless this pull request is for something minor like a fixing a typo, you should create an issue first.
--> -->

View File

@ -2,7 +2,7 @@
<!-- <img align='left' width='0' height='192px' hspace='10'/> --> <!-- <img align='left' width='0' height='192px' hspace='10'/> -->
<!-- omit in toc --> <!-- omit in toc -->
# [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 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) [![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? ## 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. 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
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 - Create a plugin for it, if you can code JavaScript
- Request someone else to make a plugin - 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 - [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** 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. 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. 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** 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** 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** 6. **Open-source and self-hosted**
It's yours. It's yours.
7. **Supports multiple databases** 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. 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 ### Screenshots
@ -91,7 +91,7 @@ For contributing instructions, or to find out all of the ways you can contribute
## Contributors ## 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 - Contributed code
- Translated - Translated
@ -106,7 +106,7 @@ Thank you to everyone to has contributed to DiscordTickets, including everyone w
## Sponsors ## 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 ### Donate
@ -114,8 +114,8 @@ Does your community or company use DiscordTickets? Sponsor the project to get yo
## License ## 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 © 2021 Isaac Saunders

View File

@ -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(homepage + '\n'));
console.log(leeks.colours.cyanBright(`Please ${link('donate', 'https://ko-fi.com/eartharoid')} if you find this bot useful`)); console.log(leeks.colours.cyanBright(`Please ${link('donate', 'https://ko-fi.com/eartharoid')} if you find this bot useful`));
console.log('\n\n'); console.log('\n\n');

View File

@ -4,21 +4,22 @@ const Command = require('../modules/commands/command');
module.exports = class NewCommand extends Command { module.exports = class NewCommand extends Command {
constructor(client) { constructor(client) {
const i18n = client.i18n.get();
super(client, { super(client, {
internal: true, internal: true,
name: 'new', name: i18n('commands.new.name'),
description: 'Create a new support ticket', description: i18n('commands.new.description'),
options: [ options: [
// { // {
// name: 'category', // name: i18n('commands.new.options.category.name'),
// type: OptionTypes.STRING, // type: OptionTypes.STRING,
// description: 'The category you would like to create a new ticket for', // description: i18n('commands.new.options.topic.description'),
// required: true, // required: true,
// }, // },
{ {
name: 'topic', name: i18n('commands.new.options.topic.name'),
type: OptionTypes.STRING, type: OptionTypes.STRING,
description: 'The topic of the ticket', description: i18n('commands.new.options.topic.description'),
required: false, required: false,
} }
] ]

View File

@ -173,6 +173,75 @@ module.exports = async (log) => {
tableName: DB_TABLE_PREFIX + 'messages' 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(); sequelize.sync();
return sequelize; return sequelize;

View File

@ -1,5 +1,5 @@
/** /**
* DiscordTickets * Discord Tickets
* Copyright (C) 2021 Isaac Saunders * Copyright (C) 2021 Isaac Saunders
* *
* This program is free software: you can redistribute it and/or modify * 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]); const node_version = Number(process.versions.node.split('.')[0]);
if (node_version < 14) 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 fs = require('fs');
const { path } = require('./utils/fs'); const { path } = require('./utils/fs');
@ -130,7 +130,7 @@ class Bot extends Client {
async postStats() { async postStats() {
/** /**
* OH NO, TELEMETRY!? * 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 * 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 if (this.config.super_secret_setting) { // you can disable it if you really want

View File

@ -1,11 +1,22 @@
{ {
"admin_only": "❌ You must be an administrator to use this command.", "admin_only": "❌ You must be an administrator to use this command.",
"bot": { "bot": {
"version": "DiscordTickets v%s by eartharoid" "version": "Discord Tickets v%s by eartharoid"
}, },
"cmd": { "commands": {
"new": { "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", "no_perm": "❌ You do not have the permissions required to use this command:\n%s",

View File

@ -2,7 +2,7 @@ const { path } = require('./utils/fs');
const config = require('../user/config'); const config = require('../user/config');
const Logger = require('leekslazylogger-fastify'); const Logger = require('leekslazylogger-fastify');
module.exports = new Logger({ module.exports = new Logger({
name: 'DiscordTickets by eartharoid', name: 'Discord Tickets by eartharoid',
debug: config.debug, debug: config.debug,
logToFile: config.logs.enabled, logToFile: config.logs.enabled,
splitFile: true, splitFile: true,

View File

@ -26,8 +26,8 @@ module.exports = {
debug: false, debug: false,
defaults: { defaults: {
colour: '#009999', colour: '#009999',
locale: 'en-GB', locale: 'en-GB', // can **not** be set for each server
log_messages: true, // required for transcripts/archives log_messages: true, // transcripts/archives will be empty if false
prefix: '-', 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.__', 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.__',
}, },