Huge Modification to Code

This commit is contained in:
Daniel Odendahl Jr
2017-03-21 19:20:47 +00:00
parent 65bf037068
commit d49fe32bf6
100 changed files with 1541 additions and 2049 deletions
+12 -10
View File
@@ -1,10 +1,15 @@
const commando = require('discord.js-commando');
const banlist = require('./banlist.json');
class ContactCommand extends commando.Command {
module.exports = class ContactCommand extends commando.Command {
constructor(Client){
super(Client, {
name: 'contact',
name: 'contact',
aliases: [
'suggest',
'report',
'bug'
],
group: 'botinfo',
memberName: 'contact',
description: 'Report bugs or request new features. (;contact Fix this command!)',
@@ -12,20 +17,17 @@ class ContactCommand extends commando.Command {
});
}
async run(message, args) {
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
let banid = message.author.id;
if (message.author.id === banlist.banned[banid]) {
let banID = message.author.id;
if (message.author.id === banlist.banned[banID]) {
message.channel.send("Sorry, you've been banned from using this command.");
} else {
this.client.users.get('242699360352206850').send("**" + message.author.username + '#' + message.author.discriminator + " (" + message.author.id + ")" + ":**\n" + message.content.split(" ").slice(1).join(" "));
message.channel.send('Message Sent! Thanks for your support!');
}
}
}
module.exports = ContactCommand;
};
+13 -15
View File
@@ -4,10 +4,14 @@ const config = require("../../config.json");
const moment = require('moment');
require('moment-duration-format');
class InfoCommand extends commando.Command {
module.exports = class InfoCommand extends commando.Command {
constructor(Client){
super(Client, {
name: 'info',
name: 'info',
aliases: [
'data',
'information'
],
group: 'botinfo',
memberName: 'info',
description: 'Gives some bot info. (;info)',
@@ -15,16 +19,12 @@ class InfoCommand extends commando.Command {
});
}
async run(message, args) {
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
if(!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return;
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log("[Command] " + message.content);
let guilds = this.client.guilds.size;
let users = this.client.users.size;
this.client.shard.fetchClientValues('guilds.size').then(results => {
this.client.shard.fetchClientValues('guilds.size').then(guilds => {
this.client.shard.fetchClientValues('voiceConnections.size').then(vCConnections => {
const embed = new Discord.RichEmbed()
.setTitle('Welcome to XiaoBot!')
@@ -37,11 +37,11 @@ class InfoCommand extends commando.Command {
.addField('Commands',
"There are a variety of commands XiaoBot can use! Use ';help' to view a list of all commands!")
.addField('Servers',
guilds + "/" + results.reduce((prev, val) => prev + val, 0), true)
this.client.guilds.size + " / " + guilds.reduce((prev, val) => prev + val, 0), true)
.addField('Shards',
this.client.options.shardCount + " (This is Shard: " + this.client.shard.id + ")", true)
.addField('Commands',
config.commandcount, true)
config.commandCount, true)
.addField('Owner',
"dragonfire535#8081", true)
.addField('Source Code',
@@ -53,7 +53,7 @@ class InfoCommand extends commando.Command {
.addField('Node Version',
process.version, true)
.addField('Voice Connections',
this.client.voiceConnections.size + "/" + vCConnections.reduce((prev, val) => prev + val, 0), true)
this.client.voiceConnections.size + " / " + vCConnections.reduce((prev, val) => prev + val, 0), true)
.addField('Library',
"[discord.js](https://discord.js.org/#/) / [commando](https://github.com/Gawdl3y/discord.js-commando)", true)
.addField('Modules',
@@ -72,6 +72,4 @@ class InfoCommand extends commando.Command {
});
});
}
}
module.exports = InfoCommand;
};
+6 -9
View File
@@ -1,9 +1,9 @@
const commando = require('discord.js-commando');
class InviteCommand extends commando.Command {
module.exports = class InviteCommand extends commando.Command {
constructor(Client){
super(Client, {
name: 'invite',
name: 'invite',
group: 'botinfo',
memberName: 'invite',
description: 'Sends you an invite for the bot, or an invite to my server, Heroes of Dreamland. (;invite)',
@@ -11,14 +11,11 @@ class InviteCommand extends commando.Command {
});
}
async run(message, args) {
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
message.channel.send("\nAdd me to your server with this link:\n" + "https://discordapp.com/oauth2/authorize?client_id=278305350804045834&scope=bot&permissions=1345846343" + "\nOr, come to my server with this link:\n" + "https://discord.gg/fqQF8mc");
message.channel.send("Add me to your server with this link:\nhttps://discordapp.com/oauth2/authorize?client_id=278305350804045834&scope=bot&permissions=1345846343\nOr, come to my server with this link:\nhttps://discord.gg/fqQF8mc");
}
}
module.exports = InviteCommand;
};
+6 -10
View File
@@ -2,10 +2,10 @@ const commando = require('discord.js-commando');
const moment = require('moment');
require('moment-duration-format');
class UptimeCommand extends commando.Command {
module.exports = class UptimeCommand extends commando.Command {
constructor(Client){
super(Client, {
name: 'uptime',
name: 'uptime',
group: 'botinfo',
memberName: 'uptime',
description: 'Displays how long the bot has been active. (;uptime)',
@@ -13,15 +13,11 @@ class UptimeCommand extends commando.Command {
});
}
async run(message, args) {
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
let guilds = this.client.guilds.array().length;
message.channel.send("I've been active on this shard for: **" + moment.duration(this.client.uptime).format('d[ days], h[ hours], m[ minutes, and ]s[ seconds]') + "** in a total of " + guilds + " Servers.");
message.channel.send("I've been active on this shard for: **" + moment.duration(this.client.uptime).format('d[ days], h[ hours], m[ minutes, and ]s[ seconds]') + "** in a total of " + this.client.guilds.size + " Servers.");
}
}
module.exports = UptimeCommand;
};