mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 00:03:09 +02:00
update
This commit is contained in:
parent
b6c1a9b10d
commit
adc1b002e7
@ -1,5 +1,6 @@
|
|||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const config = require('../config.json');
|
const config = require('../config.json');
|
||||||
|
const leeks = require('leeks.js');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'add',
|
name: 'add',
|
||||||
description: 'Add a member to a ticket channel',
|
description: 'Add a member to a ticket channel',
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const config = require('../config.json');
|
const config = require('../config.json');
|
||||||
|
const leeks = require('leeks.js');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'close',
|
name: 'close',
|
||||||
description: 'Close a ticket',
|
description: 'Close a ticket',
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const config = require('../config.json');
|
const config = require('../config.json');
|
||||||
|
const leeks = require('leeks.js');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'example-command',
|
name: 'example-command',
|
||||||
description: 'An example command',
|
description: 'An example command',
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const { version } = require('../package.json');
|
const { version } = require('../package.json');
|
||||||
const config = require('../config.json');
|
const config = require('../config.json');
|
||||||
|
const leeks = require('leeks.js');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'help',
|
name: 'help',
|
||||||
description: 'Displays help menu',
|
description: 'Displays help menu',
|
||||||
@ -38,7 +39,7 @@ module.exports = {
|
|||||||
.setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
.setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
||||||
|
|
||||||
var cmds = [];
|
var cmds = [];
|
||||||
cmds.push(commands.map(command => embed.addField(`${config.prefix}${command.name}`, `\`${command.description}\``, true)));
|
cmds.push(commands.map(command => embed.addField(`${config.prefix}${command.name}`, `\`${command.description}\``)));
|
||||||
message.channel.send(embed)
|
message.channel.send(embed)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (message.channel.type === 'dm') return;
|
if (message.channel.type === 'dm') return;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const config = require('../config.json');
|
const config = require('../config.json');
|
||||||
|
const leeks = require('leeks.js');
|
||||||
const randomString = require('random-string');
|
const randomString = require('random-string');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'new',
|
name: 'new',
|
||||||
@ -17,28 +18,28 @@ module.exports = {
|
|||||||
const ticketChannel = "channel";
|
const ticketChannel = "channel";
|
||||||
let topic = args.join(" ");
|
let topic = args.join(" ");
|
||||||
|
|
||||||
function num(){
|
|
||||||
return randomString({
|
let num = randomString({
|
||||||
length: 4,
|
length: 4,
|
||||||
numeric: true,
|
numeric: true,
|
||||||
letters: false,
|
letters: false,
|
||||||
special: false,
|
special: false,
|
||||||
})
|
});
|
||||||
};
|
|
||||||
|
|
||||||
// log
|
// log
|
||||||
if(config.useEmbeds) {
|
// if(config.useEmbeds) {
|
||||||
const embed = new Discord.RichEmbed()
|
// const embed = new Discord.RichEmbed()
|
||||||
.setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL)
|
// .setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL)
|
||||||
.setTitle("New Ticket")
|
// .setTitle("New Ticket")
|
||||||
.addField("Username", message.author.tag, true)
|
// .addField("Username", message.author.tag, true)
|
||||||
.addField("Channel", ticketChannel, true)
|
// .addField("Channel", ticketChannel, true)
|
||||||
.setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
// .setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
||||||
client.channels.get(config.logChannel).send({embed})
|
// client.channels.get(config.logChannel).send({embed})
|
||||||
} else {
|
// } else {
|
||||||
client.channels.get(config.logChannel).send(`New ticket created by **${message.author.tag} (${message.author.id})**`);
|
// client.channels.get(config.logChannel).send(`New ticket created by **${message.author.tag} (${message.author.id})**`);
|
||||||
}
|
// }
|
||||||
|
console.log(leeks.colors.cyan(`${message.author.tag} created a new ticket (#ticket-${num})`))
|
||||||
|
|
||||||
// command ends here
|
// command ends here
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const config = require('../config.json');
|
const config = require('../config.json');
|
||||||
|
const leeks = require('leeks.js');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'ping',
|
name: 'ping',
|
||||||
description: 'Calculate latency',
|
description: 'Calculate latency',
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const config = require('../config.json');
|
const config = require('../config.json');
|
||||||
|
const leeks = require('leeks.js');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'remove',
|
name: 'remove',
|
||||||
description: 'Remove a member from a ticket',
|
description: 'Remove a member from a ticket',
|
||||||
|
28
index.js
28
index.js
@ -46,13 +46,11 @@ const { version, homepage } = require('./package.json');
|
|||||||
const client = new Discord.Client();
|
const client = new Discord.Client();
|
||||||
client.commands = new Discord.Collection();
|
client.commands = new Discord.Collection();
|
||||||
const cooldowns = new Discord.Collection();
|
const cooldowns = new Discord.Collection();
|
||||||
|
const now = Date.now();
|
||||||
|
|
||||||
|
|
||||||
const commands = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
|
const commands = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
|
||||||
|
|
||||||
client.once('ready', () => { // after bot has logged in
|
console.log(leeks.colors.magentaBright(`
|
||||||
console.log(leeks.colors.magentaBright(`
|
|
||||||
######## #### ###### ###### ####### ######## ########
|
######## #### ###### ###### ####### ######## ########
|
||||||
## ## ## ## ## ## ## ## ## ## ## ## ##
|
## ## ## ## ## ## ## ## ## ## ## ## ##
|
||||||
## ## ## ## ## ## ## ## ## ## ##
|
## ## ## ## ## ## ## ## ## ## ##
|
||||||
@ -69,11 +67,15 @@ client.once('ready', () => { // after bot has logged in
|
|||||||
## ## ## ## ## ## ## ## ## ##
|
## ## ## ## ## ## ## ## ## ##
|
||||||
## #### ###### ## ## ######## ## ######
|
## #### ###### ## ## ######## ## ######
|
||||||
|
|
||||||
`)); // banner appears in console
|
`)); // banner appears in console
|
||||||
console.log(leeks.colors.yellow(leeks.styles.bold(`DiscordTickets v${version} - Made By Eartharoid`)));
|
console.log(leeks.colors.yellow(leeks.styles.bold(`DiscordTickets v${version} - Made By Eartharoid`)));
|
||||||
console.log(leeks.colors.yellow(leeks.styles.bold(homepage)));
|
console.log(leeks.colors.yellow(leeks.styles.bold(homepage)));
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log(`Starting up...`)
|
console.log(`Starting up...`)
|
||||||
|
|
||||||
|
|
||||||
|
client.once('ready', () => { // after bot has logged in
|
||||||
|
|
||||||
console.log(leeks.colors.cyan(`Initialising bot...`))
|
console.log(leeks.colors.cyan(`Initialising bot...`))
|
||||||
for (const file of commands) {
|
for (const file of commands) {
|
||||||
const command = require(`./commands/${file}`);
|
const command = require(`./commands/${file}`);
|
||||||
@ -106,7 +108,10 @@ client.once('ready', () => { // after bot has logged in
|
|||||||
}
|
}
|
||||||
if (client.guilds.get(config.guildID).member(client.user).hasPermission("ADMINISTRATOR", false)) {
|
if (client.guilds.get(config.guildID).member(client.user).hasPermission("ADMINISTRATOR", false)) {
|
||||||
console.log(leeks.colors.bgYellowBright(leeks.colors.black(`Checking permissions...`)))
|
console.log(leeks.colors.bgYellowBright(leeks.colors.black(`Checking permissions...`)))
|
||||||
console.log(leeks.colors.green(`Required permissions have been granted`))
|
setTimeout(function() {
|
||||||
|
console.log(leeks.colors.green(`Required permissions have been granted\n\n`))
|
||||||
|
}, 1250);
|
||||||
|
|
||||||
if (config.useEmbeds) {
|
if (config.useEmbeds) {
|
||||||
const embed = new Discord.RichEmbed()
|
const embed = new Discord.RichEmbed()
|
||||||
.setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL)
|
.setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL)
|
||||||
@ -121,7 +126,7 @@ client.once('ready', () => { // after bot has logged in
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(leeks.colors.red(`Required permissions have not been granted`))
|
console.log(leeks.colors.red(`Required permissions have not been granted`))
|
||||||
console.log(leeks.colors.red(`Please give the bot the 'ADMINISTRATOR' permission`))
|
console.log(leeks.colors.red(`Please give the bot the 'ADMINISTRATOR' permission\n\n`))
|
||||||
if (config.useEmbeds) {
|
if (config.useEmbeds) {
|
||||||
const embed = new Discord.RichEmbed()
|
const embed = new Discord.RichEmbed()
|
||||||
.setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL)
|
.setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL)
|
||||||
@ -210,7 +215,6 @@ client.on('message', async message => {
|
|||||||
cooldowns.set(command.name, new Discord.Collection());
|
cooldowns.set(command.name, new Discord.Collection());
|
||||||
}
|
}
|
||||||
|
|
||||||
const now = Date.now();
|
|
||||||
const timestamps = cooldowns.get(command.name);
|
const timestamps = cooldowns.get(command.name);
|
||||||
const cooldownAmount = (command.cooldown || 3) * 1000;
|
const cooldownAmount = (command.cooldown || 3) * 1000;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user