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': [
|
'no-control-regex': [
|
||||||
'off'
|
'off'
|
||||||
|
],
|
||||||
|
'no-console': [
|
||||||
|
'off'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -9,10 +9,10 @@ DiscordTickets is a Discord bot for managing support ticket channels, to allow y
|
|||||||
- Highly customisable
|
- Highly customisable
|
||||||
- Ticket "panel" / "widget" (react to embed to create ticket)
|
- Ticket "panel" / "widget" (react to embed to create ticket)
|
||||||
- Simple commands
|
- 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
|
- Most (all of the best) features of the premium bots, for free
|
||||||
- Self-hosted with your bot application, your logo and guild name
|
- 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
|
## Screenshot
|
||||||
|
|
||||||
@ -31,4 +31,4 @@ For installation, configuration, usage, and other information, **go to the [wiki
|
|||||||
|
|
||||||
## Donate
|
## 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"
|
"sqlite3": "^5.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"mysql2": "2.x"
|
"mysql2": "2.x",
|
||||||
|
"mariadb": "2.x",
|
||||||
|
"pg": "8.x",
|
||||||
|
"tedious": "9.x"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^7.10.0",
|
"eslint": "^7.10.0",
|
||||||
|
@ -34,17 +34,15 @@ module.exports = {
|
|||||||
|
|
||||||
let channel = message.mentions.channels.first();
|
let channel = message.mentions.channels.first();
|
||||||
|
|
||||||
if(!channel) {
|
if (!channel) {
|
||||||
|
|
||||||
channel = message.channel;
|
channel = message.channel;
|
||||||
ticket = await Ticket.findOne({ where: { channel: message.channel.id } });
|
ticket = await Ticket.findOne({ where: { channel: message.channel.id } });
|
||||||
if(!ticket)
|
if(!ticket)
|
||||||
return message.channel.send(notTicket);
|
return message.channel.send(notTicket);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ticket = await Ticket.findOne({ where: { channel: channel.id } });
|
ticket = await Ticket.findOne({ where: { channel: channel.id } });
|
||||||
if(!ticket) {
|
if (!ticket) {
|
||||||
notTicket
|
notTicket
|
||||||
.setTitle(':x: **Channel is not a ticket**')
|
.setTitle(':x: **Channel is not a ticket**')
|
||||||
.setDescription(`${channel} is not a ticket channel.`);
|
.setDescription(`${channel} is not a ticket channel.`);
|
||||||
@ -64,11 +62,9 @@ module.exports = {
|
|||||||
.setFooter(guild.name, guild.iconURL())
|
.setFooter(guild.name, guild.iconURL())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let member = guild.member(message.mentions.users.first() || guild.members.cache.get(args[0]));
|
let member = guild.member(message.mentions.users.first() || guild.members.cache.get(args[0]));
|
||||||
|
|
||||||
if(!member)
|
if (!member)
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
new MessageEmbed()
|
new MessageEmbed()
|
||||||
.setColor(config.err_colour)
|
.setColor(config.err_colour)
|
||||||
@ -88,7 +84,7 @@ module.exports = {
|
|||||||
READ_MESSAGE_HISTORY: true
|
READ_MESSAGE_HISTORY: true
|
||||||
});
|
});
|
||||||
|
|
||||||
if(channel.id !== message.channel.id)
|
if (channel.id !== message.channel.id)
|
||||||
channel.send(
|
channel.send(
|
||||||
new MessageEmbed()
|
new MessageEmbed()
|
||||||
.setColor(config.colour)
|
.setColor(config.colour)
|
||||||
@ -99,7 +95,6 @@ module.exports = {
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
message.channel.send(
|
message.channel.send(
|
||||||
new MessageEmbed()
|
new MessageEmbed()
|
||||||
.setColor(config.colour)
|
.setColor(config.colour)
|
||||||
|
@ -156,7 +156,6 @@ module.exports = {
|
|||||||
)
|
)
|
||||||
embed.addField('Web archive', await archive.export(Ticket, channel));
|
embed.addField('Web archive', await archive.export(Ticket, channel));
|
||||||
|
|
||||||
|
|
||||||
if (embed.fields.length < 1)
|
if (embed.fields.length < 1)
|
||||||
embed.setDescription(`No text transcripts or archive data exists for ticket ${ticket.id}`);
|
embed.setDescription(`No text transcripts or archive data exists for ticket ${ticket.id}`);
|
||||||
|
|
||||||
|
@ -26,13 +26,13 @@ module.exports = {
|
|||||||
let chanID = await Setting.findOne({ where: { key: 'panel_chan_id' } });
|
let chanID = await Setting.findOne({ where: { key: 'panel_chan_id' } });
|
||||||
let panel;
|
let panel;
|
||||||
|
|
||||||
if(!chanID)
|
if (!chanID)
|
||||||
chanID = await Setting.create({
|
chanID = await Setting.create({
|
||||||
key: 'panel_chan_id',
|
key: 'panel_chan_id',
|
||||||
value: message.channel.id,
|
value: message.channel.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!msgID) {
|
if (!msgID) {
|
||||||
msgID = await Setting.create({
|
msgID = await Setting.create({
|
||||||
key: 'panel_msg_id',
|
key: 'panel_msg_id',
|
||||||
value: '',
|
value: '',
|
||||||
|
@ -34,11 +34,11 @@ module.exports = {
|
|||||||
|
|
||||||
let channel = message.mentions.channels.first();
|
let channel = message.mentions.channels.first();
|
||||||
|
|
||||||
if(!channel) {
|
if (!channel) {
|
||||||
|
|
||||||
channel = message.channel;
|
channel = message.channel;
|
||||||
ticket = await Ticket.findOne({ where: { channel: message.channel.id } });
|
ticket = await Ticket.findOne({ where: { channel: message.channel.id } });
|
||||||
if(!ticket)
|
if (!ticket)
|
||||||
return message.channel.send(notTicket);
|
return message.channel.send(notTicket);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -52,7 +52,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(message.author.id !== ticket.creator && !message.member.roles.cache.has(config.staff_role))
|
if (message.author.id !== ticket.creator && !message.member.roles.cache.has(config.staff_role))
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
new MessageEmbed()
|
new MessageEmbed()
|
||||||
.setColor(config.err_colour)
|
.setColor(config.err_colour)
|
||||||
|
@ -80,11 +80,9 @@ module.exports = {
|
|||||||
let open = [],
|
let open = [],
|
||||||
closed = [];
|
closed = [];
|
||||||
|
|
||||||
|
|
||||||
for (let t in openTickets.rows) {
|
for (let t in openTickets.rows) {
|
||||||
let desc = openTickets.rows[t].topic.substring(0, 30);
|
let desc = openTickets.rows[t].topic.substring(0, 30);
|
||||||
open.push(`> <#${openTickets.rows[t].channel}>: \`${desc}${desc.length > 20 ? '...' : ''}\``);
|
open.push(`> <#${openTickets.rows[t].channel}>: \`${desc}${desc.length > 20 ? '...' : ''}\``);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let t in closedTickets.rows) {
|
for (let t in closedTickets.rows) {
|
||||||
|
@ -50,6 +50,5 @@ module.exports = {
|
|||||||
edited: true
|
edited: true
|
||||||
}) + '\n');
|
}) + '\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
|
require('./modules/updater')(); // check for updates
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* storage
|
* storage
|
||||||
*/
|
*/
|
||||||
@ -48,14 +47,40 @@ const { Sequelize, Model, DataTypes } = require('sequelize');
|
|||||||
|
|
||||||
let sequelize;
|
let sequelize;
|
||||||
|
|
||||||
if(config.storage.type === 'mysql') {
|
switch (config.storage.type) {
|
||||||
|
case 'mysql':
|
||||||
log.info('Connecting to MySQL database...');
|
log.info('Connecting to MySQL database...');
|
||||||
sequelize = new Sequelize(process.env.DB_NAME, process.env.DB_USER, process.env.DB_PASS, {
|
sequelize = new Sequelize(process.env.DB_NAME, process.env.DB_USER, process.env.DB_PASS, {
|
||||||
dialect: 'mysql',
|
dialect: 'mysql',
|
||||||
host: process.env.DB_HOST,
|
host: process.env.DB_HOST,
|
||||||
logging: log.debug
|
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');
|
log.info('Using SQLite storage');
|
||||||
sequelize = new Sequelize({
|
sequelize = new Sequelize({
|
||||||
dialect: 'sqlite',
|
dialect: 'sqlite',
|
||||||
|
@ -17,7 +17,7 @@ const fetch = require('node-fetch');
|
|||||||
|
|
||||||
module.exports.add = (message) => {
|
module.exports.add = (message) => {
|
||||||
|
|
||||||
if(message.type !== 'DEFAULT') return;
|
if (message.type !== 'DEFAULT') return;
|
||||||
|
|
||||||
if (config.transcripts.text.enabled) { // text transcripts
|
if (config.transcripts.text.enabled) { // text transcripts
|
||||||
let path = `user/transcripts/text/${message.channel.id}.txt`,
|
let path = `user/transcripts/text/${message.channel.id}.txt`,
|
||||||
|
@ -15,13 +15,10 @@ version = 'v' + version;
|
|||||||
const boxen = require('boxen');
|
const boxen = require('boxen');
|
||||||
const link = require('terminal-link');
|
const link = require('terminal-link');
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = async () => {
|
||||||
if(!config.updater)
|
if(!config.updater)
|
||||||
return;
|
return;
|
||||||
|
const json = await (await fetch('https://api.github.com/repos/eartharoid/DiscordTickets/releases')).json();
|
||||||
fetch('https://api.github.com/repos/eartharoid/DiscordTickets/releases')
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(json => {
|
|
||||||
const update = json[0];
|
const update = json[0];
|
||||||
let notice = [];
|
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