mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 00:03:09 +02:00
update
This commit is contained in:
parent
f9a725d81a
commit
d005cc48d1
22
commands/add.js
Normal file
22
commands/add.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
const Discord = require('discord.js');
|
||||||
|
const config = require('../config.json');
|
||||||
|
module.exports = {
|
||||||
|
name: 'add',
|
||||||
|
description: 'Add a member to a ticket channel',
|
||||||
|
usage: '<@member>',
|
||||||
|
aliases: ['adduser'],
|
||||||
|
example: 'add @exampleUser',
|
||||||
|
args: false,
|
||||||
|
cooldown: config.cooldown,
|
||||||
|
guildOnly: true,
|
||||||
|
execute(message, args) {
|
||||||
|
const client = message.client;
|
||||||
|
// command starts here
|
||||||
|
message.delete();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// command ends here
|
||||||
|
},
|
||||||
|
};
|
22
commands/close.js
Normal file
22
commands/close.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
const Discord = require('discord.js');
|
||||||
|
const config = require('../config.json');
|
||||||
|
module.exports = {
|
||||||
|
name: 'close',
|
||||||
|
description: 'Close a ticket',
|
||||||
|
usage: '',
|
||||||
|
aliases: ['none'],
|
||||||
|
example: '',
|
||||||
|
args: false,
|
||||||
|
cooldown: config.cooldown,
|
||||||
|
guildOnly: true,
|
||||||
|
execute(message, args) {
|
||||||
|
const client = message.client;
|
||||||
|
// command starts here
|
||||||
|
message.delete();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// command ends here
|
||||||
|
},
|
||||||
|
};
|
@ -4,10 +4,11 @@ module.exports = {
|
|||||||
name: 'example-command',
|
name: 'example-command',
|
||||||
description: 'An example command',
|
description: 'An example command',
|
||||||
usage: '[args]',
|
usage: '[args]',
|
||||||
aliases: ['command', 'commands'],
|
aliases: ['none'],
|
||||||
example: 'example-command',
|
example: 'example-command',
|
||||||
args: false,
|
args: false,
|
||||||
cooldown: config.cooldown,
|
cooldown: config.cooldown,
|
||||||
|
guildOnly: true,
|
||||||
execute(message, args) {
|
execute(message, args) {
|
||||||
const client = message.client;
|
const client = message.client;
|
||||||
// command starts here
|
// command starts here
|
||||||
|
@ -9,6 +9,7 @@ module.exports = {
|
|||||||
example: 'help new',
|
example: 'help new',
|
||||||
args: false,
|
args: false,
|
||||||
cooldown: config.cooldown,
|
cooldown: config.cooldown,
|
||||||
|
guildOnly: true,
|
||||||
execute(message, args) {
|
execute(message, args) {
|
||||||
const client = message.client;
|
const client = message.client;
|
||||||
// command starts here
|
// command starts here
|
||||||
@ -65,6 +66,7 @@ module.exports = {
|
|||||||
const cmd = new Discord.RichEmbed()
|
const cmd = new Discord.RichEmbed()
|
||||||
.setAuthor(`${client.user.username} / Commands`, client.user.avatarURL)
|
.setAuthor(`${client.user.username} / Commands`, client.user.avatarURL)
|
||||||
.setColor(config.colour)
|
.setColor(config.colour)
|
||||||
|
.addField(`Command`,`\`${command.name}\``, true)
|
||||||
.setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
.setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
||||||
|
|
||||||
if (command.aliases) cmd.addField("Aliases", `\`${command.aliases.join(', ')}\``, true);
|
if (command.aliases) cmd.addField("Aliases", `\`${command.aliases.join(', ')}\``, true);
|
||||||
|
@ -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 randomString = require('random-string');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'new',
|
name: 'new',
|
||||||
description: 'Create a new ticket',
|
description: 'Create a new ticket',
|
||||||
@ -8,11 +9,22 @@ module.exports = {
|
|||||||
example: 'new I found an error',
|
example: 'new I found an error',
|
||||||
args: true,
|
args: true,
|
||||||
cooldown: config.cooldown,
|
cooldown: config.cooldown,
|
||||||
|
guildOnly: true,
|
||||||
execute(message, args) {
|
execute(message, args) {
|
||||||
const client = message.client;
|
const client = message.client;
|
||||||
// command starts here
|
// command starts here
|
||||||
message.delete();
|
message.delete();
|
||||||
const ticketChannel = "channel";
|
const ticketChannel = "channel";
|
||||||
|
let topic = args.join(" ");
|
||||||
|
|
||||||
|
function num(){
|
||||||
|
return randomString({
|
||||||
|
length: 4,
|
||||||
|
numeric: true,
|
||||||
|
letters: false,
|
||||||
|
special: false,
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
// log
|
// log
|
||||||
if(config.useEmbeds) {
|
if(config.useEmbeds) {
|
||||||
|
29
commands/ping.js
Normal file
29
commands/ping.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
const Discord = require('discord.js');
|
||||||
|
const config = require('../config.json');
|
||||||
|
module.exports = {
|
||||||
|
name: 'ping',
|
||||||
|
description: 'Calculate latency',
|
||||||
|
usage: '',
|
||||||
|
aliases: ['none'],
|
||||||
|
example: '',
|
||||||
|
args: false,
|
||||||
|
cooldown: config.cooldown,
|
||||||
|
guildOnly: true,
|
||||||
|
execute(message, args) {
|
||||||
|
const client = message.client;
|
||||||
|
// command starts here
|
||||||
|
message.delete();
|
||||||
|
const embed = new Discord.RichEmbed()
|
||||||
|
.setAuthor(`${client.user.username} / Pong!`, client.user.avatarURL)
|
||||||
|
.setColor(config.colour)
|
||||||
|
.setTimestamp()
|
||||||
|
.addField("API Latency", `${Math.round(message.client.ping)}ms`, true)
|
||||||
|
.setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
||||||
|
message.channel.send({embed})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// command ends here
|
||||||
|
},
|
||||||
|
};
|
22
commands/remove.js
Normal file
22
commands/remove.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
const Discord = require('discord.js');
|
||||||
|
const config = require('../config.json');
|
||||||
|
module.exports = {
|
||||||
|
name: 'remove',
|
||||||
|
description: 'Remove a member from a ticket',
|
||||||
|
usage: '<@member>',
|
||||||
|
aliases: ['kick'],
|
||||||
|
example: 'remove @exampleUser',
|
||||||
|
args: false,
|
||||||
|
cooldown: config.cooldown,
|
||||||
|
guildOnly: true,
|
||||||
|
execute(message, args) {
|
||||||
|
const client = message.client;
|
||||||
|
// command starts here
|
||||||
|
message.delete();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// command ends here
|
||||||
|
},
|
||||||
|
};
|
14
index.js
14
index.js
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
____ _ _____ _ _ _
|
____ _ _____ _ _
|
||||||
| _ \ (_) ___ ___ ___ _ __ __| | |_ _| (_) ___ | | __ ___ | |_ ___
|
| _ \ (_) ___ ___ ___ _ __ __| | |_ _| (_) ___ | | __ ___ | |_ ___
|
||||||
| | | | | | / __| / __| / _ \ | '__| / _` | | | | | / __| | |/ / / _ \ | __| / __|
|
| | | | | | / __| / __| / _ \ | '__| / _` | | | | | / __| | |/ / / _ \ | __| / __|
|
||||||
| |_| | | | \__ \ | (__ | (_) | | | | (_| | | | | | | (__ | < | __/ | |_ \__ \
|
| |_| | | | \__ \ | (__ | (_) | | | | (_| | | | | | | (__ | < | __/ | |_ \__ \
|
||||||
@ -138,12 +138,12 @@ client.once('ready', () => { // after bot has logged in
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on('message', message => {
|
client.on('message', async message => {
|
||||||
// if (!message.content.startsWith(config.prefix) || message.author.bot) return;
|
// if (!message.content.startsWith(config.prefix) || message.author.bot) return;
|
||||||
if (message.author.bot) return;
|
if (message.author.bot) return;
|
||||||
if (message.channel.type === "dm") {
|
if (message.channel.type === "dm") {
|
||||||
if (message.author.id === client.user.id) return;
|
if (message.author.id === client.user.id) return;
|
||||||
message.channel.send(`Sorry, commands can only be used on the server.`)
|
// message.channel.send(`Sorry, commands can only be used on the server.`)
|
||||||
if (config.logDMs) {
|
if (config.logDMs) {
|
||||||
if (config.useEmbeds) {
|
if (config.useEmbeds) {
|
||||||
const embed = new Discord.RichEmbed()
|
const embed = new Discord.RichEmbed()
|
||||||
@ -167,9 +167,9 @@ client.on('message', message => {
|
|||||||
|
|
||||||
// const args = message.content.slice(config.prefix.length).split(/ +/);
|
// const args = message.content.slice(config.prefix.length).split(/ +/);
|
||||||
|
|
||||||
|
|
||||||
const prefixRegex = new RegExp(`^(<@!?${client.user.id}>|\\${config.prefix})\\s*`);
|
const prefixRegex = new RegExp(`^(<@!?${client.user.id}>|\\${config.prefix})\\s*`);
|
||||||
if (!prefixRegex.test(message.content)) return;
|
if (!prefixRegex.test(message.content)) return;
|
||||||
|
|
||||||
const [, matchedPrefix] = message.content.match(prefixRegex);
|
const [, matchedPrefix] = message.content.match(prefixRegex);
|
||||||
const args = message.content.slice(matchedPrefix.length).trim().split(/ +/);
|
const args = message.content.slice(matchedPrefix.length).trim().split(/ +/);
|
||||||
const commandName = args.shift().toLowerCase();
|
const commandName = args.shift().toLowerCase();
|
||||||
@ -180,6 +180,10 @@ client.on('message', message => {
|
|||||||
|
|
||||||
if (!command) return;
|
if (!command) return;
|
||||||
|
|
||||||
|
if (command.guildOnly && message.channel.type !== 'text') {
|
||||||
|
return message.channel.send(`Sorry, this command can only be used on the server.`)
|
||||||
|
}
|
||||||
|
|
||||||
if (command.args && !args.length) {
|
if (command.args && !args.length) {
|
||||||
// let reply = `:x: **Arguments were expected but none were provided.**`;
|
// let reply = `:x: **Arguments were expected but none were provided.**`;
|
||||||
//
|
//
|
||||||
@ -238,7 +242,7 @@ client.on('message', message => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
message.channel.send(`:x: **Oof!** An error occured whilst executing that command.\nThe issue has been reported.`);
|
message.channel.send(`:x: **Oof!** An error occured whilst executing that command.\nThe issue has been reported.`);
|
||||||
console.log(leeks.colors.red(`[ERROR] An unknown error occured whilst executing '${command}' command`));
|
console.log(leeks.colors.red(`[ERROR] An unknown error occured whilst executing the '${command.name}' command`));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord.js": "^11.4.2",
|
"discord.js": "^11.4.2",
|
||||||
"leeks.js": "^0.0.1"
|
"leeks.js": "^0.0.1",
|
||||||
|
"random-string": "^0.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
Reference in New Issue
Block a user