mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 00:03:09 +02:00
features
This commit is contained in:
parent
5ef7dc3fc4
commit
b0ad6b7c88
@ -32,6 +32,9 @@ module.exports = {
|
||||
],
|
||||
'no-control-regex': [
|
||||
'off'
|
||||
],
|
||||
'no-console': [
|
||||
'off'
|
||||
]
|
||||
}
|
||||
};
|
@ -9,10 +9,10 @@ DiscordTickets is a Discord bot for managing support ticket channels, to allow y
|
||||
- Highly customisable
|
||||
- Ticket "panel" / "widget" (react to embed to create ticket)
|
||||
- Simple commands
|
||||
- SQLite (easy, default) **or** MySQL (recommend) storage
|
||||
- Supports multiple databases: SQLite (easy, default), MySQL (recommend) storage, MariaDB, PostgresSQL and Microsoft SQL Server
|
||||
- Most (all of the best) features of the premium bots, for free
|
||||
- Self-hosted with your bot application, your logo and guild name
|
||||
- Optional express.js server for web archvies: [DiscordTickets-Portal](https://github.com/eartharoid/DiscordTickets-Portal/)
|
||||
- Optional express.js server for web archives: [DiscordTickets-Portal](https://github.com/eartharoid/DiscordTickets-Portal/)
|
||||
|
||||
## Screenshot
|
||||
|
||||
@ -31,4 +31,4 @@ For installation, configuration, usage, and other information, **go to the [wiki
|
||||
|
||||
## Donate
|
||||
|
||||
[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/B0B214BHI)
|
||||
[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/eartharoid)
|
||||
|
@ -19,7 +19,10 @@
|
||||
"sqlite3": "^5.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"mysql2": "2.x"
|
||||
"mysql2": "2.x",
|
||||
"mariadb": "2.x",
|
||||
"pg": "8.x",
|
||||
"tedious": "9.x"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.10.0",
|
||||
|
@ -35,14 +35,12 @@ module.exports = {
|
||||
let channel = message.mentions.channels.first();
|
||||
|
||||
if (!channel) {
|
||||
|
||||
channel = message.channel;
|
||||
ticket = await Ticket.findOne({ where: { channel: message.channel.id } });
|
||||
if(!ticket)
|
||||
return message.channel.send(notTicket);
|
||||
|
||||
} else {
|
||||
|
||||
ticket = await Ticket.findOne({ where: { channel: channel.id } });
|
||||
if (!ticket) {
|
||||
notTicket
|
||||
@ -64,8 +62,6 @@ module.exports = {
|
||||
.setFooter(guild.name, guild.iconURL())
|
||||
);
|
||||
|
||||
|
||||
|
||||
let member = guild.member(message.mentions.users.first() || guild.members.cache.get(args[0]));
|
||||
|
||||
if (!member)
|
||||
@ -99,7 +95,6 @@ module.exports = {
|
||||
);
|
||||
|
||||
|
||||
|
||||
message.channel.send(
|
||||
new MessageEmbed()
|
||||
.setColor(config.colour)
|
||||
|
@ -156,7 +156,6 @@ module.exports = {
|
||||
)
|
||||
embed.addField('Web archive', await archive.export(Ticket, channel));
|
||||
|
||||
|
||||
if (embed.fields.length < 1)
|
||||
embed.setDescription(`No text transcripts or archive data exists for ticket ${ticket.id}`);
|
||||
|
||||
|
@ -80,11 +80,9 @@ module.exports = {
|
||||
let open = [],
|
||||
closed = [];
|
||||
|
||||
|
||||
for (let t in openTickets.rows) {
|
||||
let desc = openTickets.rows[t].topic.substring(0, 30);
|
||||
open.push(`> <#${openTickets.rows[t].channel}>: \`${desc}${desc.length > 20 ? '...' : ''}\``);
|
||||
|
||||
}
|
||||
|
||||
for (let t in closedTickets.rows) {
|
||||
|
@ -50,6 +50,5 @@ module.exports = {
|
||||
edited: true
|
||||
}) + '\n');
|
||||
|
||||
|
||||
}
|
||||
};
|
31
src/index.js
31
src/index.js
@ -40,7 +40,6 @@ log.multi(log); // required to allow other files to access the logger
|
||||
|
||||
require('./modules/updater')(); // check for updates
|
||||
|
||||
|
||||
/**
|
||||
* storage
|
||||
*/
|
||||
@ -48,14 +47,40 @@ const { Sequelize, Model, DataTypes } = require('sequelize');
|
||||
|
||||
let sequelize;
|
||||
|
||||
if(config.storage.type === 'mysql') {
|
||||
switch (config.storage.type) {
|
||||
case 'mysql':
|
||||
log.info('Connecting to MySQL database...');
|
||||
sequelize = new Sequelize(process.env.DB_NAME, process.env.DB_USER, process.env.DB_PASS, {
|
||||
dialect: 'mysql',
|
||||
host: process.env.DB_HOST,
|
||||
logging: log.debug
|
||||
});
|
||||
} else {
|
||||
break;
|
||||
case 'mariadb':
|
||||
log.info('Connecting to MariaDB database...');
|
||||
sequelize = new Sequelize(process.env.DB_NAME, process.env.DB_USER, process.env.DB_PASS, {
|
||||
dialect: 'mariadb',
|
||||
host: process.env.DB_HOST,
|
||||
logging: log.debug
|
||||
});
|
||||
break;
|
||||
case 'postgres':
|
||||
log.info('Connecting to PostgresSQL database...');
|
||||
sequelize = new Sequelize(process.env.DB_NAME, process.env.DB_USER, process.env.DB_PASS, {
|
||||
dialect: 'postgres',
|
||||
host: process.env.DB_HOST,
|
||||
logging: log.debug
|
||||
});
|
||||
break;
|
||||
case 'microsoft':
|
||||
log.info('Connecting to Microsoft SQL Server database...');
|
||||
sequelize = new Sequelize(process.env.DB_NAME, process.env.DB_USER, process.env.DB_PASS, {
|
||||
dialect: 'mssql',
|
||||
host: process.env.DB_HOST,
|
||||
logging: log.debug
|
||||
});
|
||||
break;
|
||||
default:
|
||||
log.info('Using SQLite storage');
|
||||
sequelize = new Sequelize({
|
||||
dialect: 'sqlite',
|
||||
|
@ -15,13 +15,10 @@ version = 'v' + version;
|
||||
const boxen = require('boxen');
|
||||
const link = require('terminal-link');
|
||||
|
||||
module.exports = () => {
|
||||
module.exports = async () => {
|
||||
if(!config.updater)
|
||||
return;
|
||||
|
||||
fetch('https://api.github.com/repos/eartharoid/DiscordTickets/releases')
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
const json = await (await fetch('https://api.github.com/repos/eartharoid/DiscordTickets/releases')).json();
|
||||
const update = json[0];
|
||||
let notice = [];
|
||||
|
||||
@ -42,5 +39,4 @@ module.exports = () => {
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
Binary file not shown.
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 698 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 577 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.3 MiB |
Loading…
Reference in New Issue
Block a user