mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-09-02 16:41:25 +03:00
features
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @name DiscordTickets
|
||||
* @author eartharoid <contact@eartharoid.me>
|
||||
* @license GNU-GPLv3
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const ChildLogger = require('leekslazylogger').ChildLogger;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @name DiscordTickets
|
||||
* @author eartharoid <contact@eartharoid.me>
|
||||
* @license GNU-GPLv3
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const ChildLogger = require('leekslazylogger').ChildLogger;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @name DiscordTickets
|
||||
* @author eartharoid <contact@eartharoid.me>
|
||||
* @license GNU-GPLv3
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const { Collection, MessageEmbed } = require('discord.js');
|
||||
@@ -23,19 +23,19 @@ module.exports = {
|
||||
I am the support bot for **${guild}**.
|
||||
Type \`${config.prefix}new\` on the server to create a new ticket.`);
|
||||
} // stop here if is DM
|
||||
|
||||
|
||||
/**
|
||||
* Ticket transcripts
|
||||
* (bots currently still allowed)
|
||||
*/
|
||||
|
||||
|
||||
let ticket = await Ticket.findOne({ where: { channel: message.channel.id } });
|
||||
if(ticket)
|
||||
if(ticket)
|
||||
archive.add(message); // add message to archive
|
||||
|
||||
if (message.author.bot || message.author.id === client.user.id) return; // goodbye bots
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Command handler
|
||||
* (no bots / self)
|
||||
@@ -49,7 +49,7 @@ Type \`${config.prefix}new\` on the server to create a new ticket.`);
|
||||
const commandName = args.shift().toLowerCase();
|
||||
const command = client.commands.get(commandName)
|
||||
|| client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
|
||||
|
||||
|
||||
if (!command || commandName === 'none') return; // not an existing command
|
||||
|
||||
if (message.guild.id !== guild.id)
|
||||
@@ -76,7 +76,7 @@ Type \`${config.prefix}new\` on the server to create a new ticket.`);
|
||||
);
|
||||
|
||||
if (!client.cooldowns.has(command.name)) client.cooldowns.set(command.name, new Collection());
|
||||
|
||||
|
||||
const now = Date.now();
|
||||
const timestamps = client.cooldowns.get(command.name);
|
||||
const cooldownAmount = (command.cooldown || config.cooldown) * 1000;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @name DiscordTickets
|
||||
* @author eartharoid <contact@eartharoid.me>
|
||||
* @license GNU-GPLv3
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const ChildLogger = require('leekslazylogger').ChildLogger;
|
||||
@@ -16,7 +16,7 @@ module.exports = {
|
||||
|
||||
if(!config.transcripts.web.enabled) return;
|
||||
|
||||
if (message.partial)
|
||||
if (message.partial)
|
||||
try {
|
||||
await message.fetch();
|
||||
} catch (err) {
|
||||
@@ -27,7 +27,7 @@ module.exports = {
|
||||
|
||||
let ticket = await Ticket.findOne({ where: { channel: message.channel.id } });
|
||||
if(!ticket) return;
|
||||
|
||||
|
||||
|
||||
let path = `user/transcripts/raw/${message.channel.id}.log`;
|
||||
let embeds = [];
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @name DiscordTickets
|
||||
* @author eartharoid <contact@eartharoid.me>
|
||||
* @license GNU-GPLv3
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const ChildLogger = require('leekslazylogger').ChildLogger;
|
||||
@@ -15,7 +15,7 @@ module.exports = {
|
||||
event: 'messageReactionAdd',
|
||||
async execute(client, [r, u], {config, Ticket, Setting}) {
|
||||
|
||||
if (r.partial)
|
||||
if (r.partial)
|
||||
try {
|
||||
await r.fetch();
|
||||
} catch (err) {
|
||||
@@ -56,7 +56,7 @@ module.exports = {
|
||||
},
|
||||
limit: config.tickets.max
|
||||
});
|
||||
|
||||
|
||||
if (tickets.count >= config.tickets.max) {
|
||||
let ticketList = [];
|
||||
for (let t in tickets.rows) {
|
||||
@@ -76,7 +76,7 @@ module.exports = {
|
||||
.setDescription(`Use \`${config.prefix}close\` in a server channel to close unneeded tickets.\n\n${ticketList.join(',\n')}`)
|
||||
.setFooter(channel.guild.name, channel.guild.iconURL())
|
||||
);
|
||||
|
||||
|
||||
|
||||
} catch (e) {
|
||||
|
||||
@@ -88,11 +88,11 @@ module.exports = {
|
||||
.setDescription(`Use \`${config.prefix}close\` to close unneeded tickets.\n\n${ticketList.join(',\n')}`)
|
||||
.setFooter(channel.guild.name + ' | This message will be deleted in 15 seconds', channel.guild.iconURL())
|
||||
);
|
||||
|
||||
|
||||
return m.delete({ timeout: 15000 });
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
let topic = 'No topic given (created via panel)';
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @name DiscordTickets
|
||||
* @author eartharoid <contact@eartharoid.me>
|
||||
* @license GNU-GPLv3
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const ChildLogger = require('leekslazylogger').ChildLogger;
|
||||
@@ -16,7 +16,7 @@ module.exports = {
|
||||
|
||||
if(!config.transcripts.web.enabled) return;
|
||||
|
||||
if (o.partial)
|
||||
if (o.partial)
|
||||
try {
|
||||
await o.fetch();
|
||||
} catch (err) {
|
||||
@@ -24,7 +24,7 @@ module.exports = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (n.partial)
|
||||
if (n.partial)
|
||||
try {
|
||||
await n.fetch();
|
||||
} catch (err) {
|
||||
@@ -33,7 +33,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
let ticket = await Ticket.findOne({ where: { channel: n.channel.id } });
|
||||
if(!ticket) return;
|
||||
if(!ticket) return;
|
||||
|
||||
let path = `user/transcripts/raw/${n.channel.id}.log`;
|
||||
let embeds = [];
|
||||
@@ -49,7 +49,6 @@ module.exports = {
|
||||
attachments: [...n.attachments.values()],
|
||||
edited: true
|
||||
}) + '\n');
|
||||
|
||||
|
||||
}
|
||||
};
|
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @name DiscordTickets
|
||||
* @author eartharoid <contact@eartharoid.me>
|
||||
* @license GNU-GPLv3
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const ChildLogger = require('leekslazylogger').ChildLogger;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @name DiscordTickets
|
||||
* @author eartharoid <contact@eartharoid.me>
|
||||
* @license GNU-GPLv3
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const ChildLogger = require('leekslazylogger').ChildLogger;
|
||||
@@ -15,7 +15,7 @@ module.exports = {
|
||||
execute(client) {
|
||||
|
||||
log.success(`Authenticated as ${client.user.tag}`);
|
||||
|
||||
|
||||
const updatePresence = () => {
|
||||
let num = Math.floor(Math.random() * config.activities.length);
|
||||
client.user.setPresence({
|
||||
@@ -26,17 +26,17 @@ module.exports = {
|
||||
}).catch(log.error);
|
||||
log.debug(`Updated presence: ${config.activity_types[num]} ${config.activities[num]}`);
|
||||
};
|
||||
|
||||
|
||||
updatePresence();
|
||||
setInterval(() => {
|
||||
updatePresence();
|
||||
}, 60000);
|
||||
|
||||
|
||||
if (client.guilds.cache.get(config.guild).member(client.user).hasPermission('ADMINISTRATOR', false))
|
||||
|
||||
|
||||
if (client.guilds.cache.get(config.guild).member(client.user).hasPermission('ADMINISTRATOR', false))
|
||||
log.success('\'ADMINISTRATOR\' permission has been granted');
|
||||
else
|
||||
log.warn('Bot does not have \'ADMINISTRATOR\' permission');
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @name DiscordTickets
|
||||
* @author eartharoid <contact@eartharoid.me>
|
||||
* @license GNU-GPLv3
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const ChildLogger = require('leekslazylogger').ChildLogger;
|
||||
|
Reference in New Issue
Block a user