Browse Source

finishing touches

master
codepupper 10 months ago
parent
commit
00d3ea2999
10 changed files with 196 additions and 3 deletions
  1. +21
    -1
      DiscordEvents/message.js
  2. +28
    -0
      DiscordModules/Developers/exec.js
  3. +48
    -0
      DiscordModules/General/bug.js
  4. +48
    -0
      DiscordModules/General/suggest.js
  5. +1
    -1
      index.js
  6. BIN
      json.sqlite
  7. +43
    -0
      package-lock.json
  8. +2
    -0
      package.json
  9. +5
    -0
      run.bat
  10. +0
    -1
      src/client/Client.js

+ 21
- 1
DiscordEvents/message.js View File

@@ -3,6 +3,9 @@ const { table } = require('quick.db');
const Servers = new table('servers');
const Users = new table('users');
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 = {
name: 'message',
run: async (client, msg) => {
@@ -39,6 +42,7 @@ module.exports = {
channel: msg.channel,
author: msg.author,
member: msg.member,
trello,
db: { users: Users, servers: Servers, backend: Backend },
utils: require('../utils'),
config: require('../config'),
@@ -77,7 +81,23 @@ module.exports = {
timestamps.set(msg.author.id, now);
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);
});
}
}
};

+ 28
- 0
DiscordModules/Developers/exec.js 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(' ')));
});
}
};

+ 48
- 0
DiscordModules/General/bug.js 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);
});
}
};

+ 48
- 0
DiscordModules/General/suggest.js 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);
});
}
};

+ 1
- 1
index.js View File

@@ -2,8 +2,8 @@ const Client = require('./src/index');
const config = require('./config');
const { log } = require('./utils/index');
const yiff = require('yiff');
yiff.sheri.setToken(config.api.sheri);

yiff.sheri.setToken(config.api.sheri);
const { util } = require('discord.js');

util.fetchRecommendedShards(config.token).then(async (count) => {


BIN
json.sqlite View File


+ 43
- 0
package-lock.json View File

@@ -1252,6 +1252,11 @@
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
"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": {
"version": "3.0.2",
"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",
"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": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.1.tgz",


+ 2
- 0
package.json View File

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


+ 5
- 0
run.bat View File

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

+ 0
- 1
src/client/Client.js View File

@@ -1,6 +1,5 @@
const { Client, Collection } = require('discord.js');
const { readdirSync: read } = require('fs');

const server = require('../../Dashboard/server');

module.exports = class Thaldrin extends Client {


Loading…
Cancel
Save