finishing touches

This commit is contained in:
codepupper 2019-11-10 21:50:18 +01:00
parent f7fd3b99a4
commit 00d3ea2999
10 changed files with 196 additions and 3 deletions

View file

@ -3,6 +3,9 @@ const { table } = require('quick.db');
const Servers = new table('servers'); const Servers = new table('servers');
const Users = new table('users'); const Users = new table('users');
const Backend = new table('backend'); const Backend = new table('backend');
const Trello = require('trello');
const config = require('../config');
const trello = new Trello(config.trello.key, config.trello.token);
module.exports = { module.exports = {
name: 'message', name: 'message',
run: async (client, msg) => { run: async (client, msg) => {
@ -39,6 +42,7 @@ module.exports = {
channel: msg.channel, channel: msg.channel,
author: msg.author, author: msg.author,
member: msg.member, member: msg.member,
trello,
db: { users: Users, servers: Servers, backend: Backend }, db: { users: Users, servers: Servers, backend: Backend },
utils: require('../utils'), utils: require('../utils'),
config: require('../config'), config: require('../config'),
@ -77,7 +81,23 @@ module.exports = {
timestamps.set(msg.author.id, now); timestamps.set(msg.author.id, now);
setTimeout(() => timestamps.delete(msg.author.id), cooldownAmount); setTimeout(() => timestamps.delete(msg.author.id), cooldownAmount);
cmd.command(ctx).then(() => {}).catch(console.error); cmd.command(ctx).then(() => {}).catch((err) => {
trello
.addCard(
cmd.name + ' | ' + err.message,
`Full Error:
${err}
Author: ${msg.author.tag} (${msg.author.id})
Server: ${msg.guild.name} (${msg.guild.id})`,
config.trello.boards.errors
)
.then((r) => {
trello.addLabelToCard(r.id, config.trello.labels.errors).catch((error) => console.log(error));
})
.catch((err) => console.log(err));
console.warn(err.message);
});
} }
} }
}; };

View file

@ -0,0 +1,28 @@
const Command = require('../../src/structures/Command');
const exec = require('shell-exec');
module.exports = class Exec extends Command {
constructor() {
super({
name: 'exec',
description: 'Execute shell commands',
aliases: [ 'ex' ],
module: 'Developers',
cooldown: 1,
guildOnly: false,
developerOnly: true,
nsfw: false
});
}
async command(ctx) {
const trying = await ctx.send('Attempting to execute ' + ctx.utils.format.bold(ctx.args.join(' ')));
await exec(ctx.args.join(' '))
.then((r) => {
trying.edit('```bash\n' + r.stdout + '```');
})
.catch((error) => {
trying.edit('Failed to execute ' + ctx.utils.format.bold(ctx.args.join(' ')));
});
}
};

View file

@ -0,0 +1,48 @@
const Command = require('../../src/structures/Command');
const D = require('discord.js');
module.exports = class Bug extends Command {
constructor() {
super({
name: 'bug',
description: 'Report a Bug in the bot',
aliases: [ 'report', 'bugreport' ],
module: 'General',
cooldown: 10,
guildOnly: false,
developerOnly: false,
nsfw: false
});
}
async command(ctx) {
/* throw new Error('Testing'); */
let abuse = new D.MessageEmbed()
.setTitle('Misuse of Command')
.setDescription(
`Please make sure to make your Suggestion as Detailed as possible.\n\nAbuse of this command will lead to complete denial of command usage.`
);
if (ctx.args.length < 1) {
return m.channel.send(abuse);
}
ctx.trello
.addCard(
ctx.args.join(' '),
`
Author: ${ctx.author.tag} (${ctx.author.id})
Server: ${ctx.guild.name} (${ctx.guild.id})`,
ctx.config.trello.boards.bugs
)
.then((r) => {
ctx.trello.addLabelToCard(r.id, ctx.config.trello.labels.bugs).catch(console.error);
let reply = new D.MessageEmbed()
.setTitle('Report Received')
.setColor(ctx.config.color)
.setDescription(ctx.args.join(' '))
.addField('URL', r.url, true)
.setThumbnail(ctx.client.user.avatarURL());
ctx.send(reply);
});
}
};

View file

@ -0,0 +1,48 @@
const Command = require('../../src/structures/Command');
const D = require('discord.js');
module.exports = class Suggest extends Command {
constructor() {
super({
name: 'suggest',
description: 'Suggest something for the Bot',
aliases: [ 'sug', 'suggestion' ],
module: 'General',
cooldown: 10,
guildOnly: false,
developerOnly: false,
nsfw: false
});
}
async command(ctx) {
/* throw new Error('Testing'); */
let abuse = new D.MessageEmbed()
.setTitle('Misuse of Command')
.setDescription(
`Please make sure to make your Suggestion as Detailed as possible.\n\nAbuse of this command will lead to complete denial of command usage.`
);
if (ctx.args.length < 1) {
return m.channel.send(abuse);
}
ctx.trello
.addCard(
ctx.args.join(' '),
`
Author: ${ctx.author.tag} (${ctx.author.id})
Server: ${ctx.guild.name} (${ctx.guild.id})`,
ctx.config.trello.boards.suggestions
)
.then((r) => {
ctx.trello.addLabelToCard(r.id, ctx.config.trello.labels.suggestions).catch(console.error);
let reply = new D.MessageEmbed()
.setTitle('Suggestion Received')
.setColor(ctx.config.color)
.setDescription(ctx.args.join(' '))
.addField('URL', r.url, true)
.setThumbnail(ctx.client.user.avatarURL());
ctx.send(reply);
});
}
};

View file

@ -2,8 +2,8 @@ const Client = require('./src/index');
const config = require('./config'); const config = require('./config');
const { log } = require('./utils/index'); const { log } = require('./utils/index');
const yiff = require('yiff'); const yiff = require('yiff');
yiff.sheri.setToken(config.api.sheri);
yiff.sheri.setToken(config.api.sheri);
const { util } = require('discord.js'); const { util } = require('discord.js');
util.fetchRecommendedShards(config.token).then(async (count) => { util.fetchRecommendedShards(config.token).then(async (count) => {

Binary file not shown.

43
package-lock.json generated
View file

@ -1252,6 +1252,11 @@
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
}, },
"shell-exec": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/shell-exec/-/shell-exec-1.0.2.tgz",
"integrity": "sha512-jyVd+kU2X+mWKMmGhx4fpWbPsjvD53k9ivqetutVW/BQ+WIZoDoP4d8vUMGezV6saZsiNoW2f9GIhg9Dondohg=="
},
"signal-exit": { "signal-exit": {
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
@ -1320,6 +1325,44 @@
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
}, },
"trello": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/trello/-/trello-0.9.1.tgz",
"integrity": "sha512-Dwkzk7ugLvhkYYFFl8bmtRjpnE6ZQ+GTzwZyMHv+BkoroS+ntOAaX3raJExgxGRx2f/+WYsuS5xZzjEVRoIGuQ==",
"requires": {
"es6-promise": "~3.0.2",
"object-assign": "~4.1.0",
"restler": "~3.3.0"
},
"dependencies": {
"es6-promise": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz",
"integrity": "sha1-AQ1YWEI6XxGJeWZfRkhqlcbuK7Y="
},
"iconv-lite": {
"version": "0.2.11",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz",
"integrity": "sha1-HOYKOleGSiktEyH/RgnKS7llrcg="
},
"qs": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-1.2.0.tgz",
"integrity": "sha1-7Qeb4oaCFH5v2aNMwrDB4OxkU+4="
},
"restler": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/restler/-/restler-3.3.0.tgz",
"integrity": "sha1-+TpZteG8LFrQwrlz94EpshgbYHY=",
"requires": {
"iconv-lite": "0.2.11",
"qs": "1.2.0",
"xml2js": "0.4.0",
"yaml": "0.2.3"
}
}
}
},
"tweetnacl": { "tweetnacl": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.1.tgz", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.1.tgz",

View file

@ -25,6 +25,8 @@
"phin": "*", "phin": "*",
"quick.db": "^7.0.0-b22", "quick.db": "^7.0.0-b22",
"restler": "^3.4.0", "restler": "^3.4.0",
"shell-exec": "^1.0.2",
"trello": "^0.9.1",
"usage": "^0.7.1", "usage": "^0.7.1",
"yiff": "^1.2.5" "yiff": "^1.2.5"
} }

5
run.bat Normal file
View file

@ -0,0 +1,5 @@
@echo off
title Discord: Thaldrin v3
:start
node index.js
goto start

View file

@ -1,6 +1,5 @@
const { Client, Collection } = require('discord.js'); const { Client, Collection } = require('discord.js');
const { readdirSync: read } = require('fs'); const { readdirSync: read } = require('fs');
const server = require('../../Dashboard/server'); const server = require('../../Dashboard/server');
module.exports = class Thaldrin extends Client { module.exports = class Thaldrin extends Client {