Current Changes are in

This commit is contained in:
Daniel Odendahl Jr
2017-03-23 22:25:44 +00:00
parent c2f06d25b1
commit 5329d08581
12 changed files with 103 additions and 90 deletions
+4 -4
View File
@@ -26,15 +26,15 @@ module.exports = class ContactCommand extends commando.Command {
let banID = message.author.id;
let messageToReport = message.content.split(" ").slice(1).join(" ");
if (message.author.id === banlist.banned[banID]) {
return message.channel.send("Sorry, you've been banned from using this command.");
let banError = await message.channel.send("Sorry, you've been banned from using this command.");
}
else {
if (!messageToReport) {
return message.channel.send(':x: Error! Please do not report nothing!');
let blankError = await message.channel.send(':x: Error! Please do not report nothing!');
}
else {
await this.client.users.get(config.owner).send(`**${message.author.username}#${message.author.discriminator} (${message.author.id}):**\n${messageToReport}`);
return message.channel.send('Message Sent! Thanks for your support!');
let errorRepoty = await this.client.users.get(config.owner).send(`**${message.author.username}#${message.author.discriminator} (${message.author.id}):**\n${messageToReport}`);
let successMes = await message.channel.send('Message Sent! Thanks for your support!');
}
}
}
+45 -47
View File
@@ -24,52 +24,50 @@ module.exports = class InfoCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
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!')
.setAuthor(this.client.user.username, this.client.user.avatarURL)
.setColor(0x00AE86)
.setDescription('XiaoBot is your personal companion for your Discord Server!')
.setFooter(`©2017 dragonfire535 | Created ${moment.duration(this.client.user.createdTimestamp - Date.now()).format('y[ years], M[ months], w[ weeks, and ]d[ days]')} ago!`)
.setThumbnail(this.client.user.avatarURL)
.setURL('http://dragonfire535.weebly.com/xiaobot.html')
.addField('Commands',
"There are a variety of commands XiaoBot can use! Use ';help' to view a list of all commands!")
.addField('Servers',
`${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)
.addField('Owner',
"dragonfire535#8081", true)
.addField('Source Code',
"[View Here](https://github.com/dragonfire535/xiaobot)", true)
.addField('Memory Usage',
`${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)}MB`, true)
.addField('Uptime',
moment.duration(this.client.uptime).format('d[d]h[h]m[m]s[s]'), true)
.addField('Node Version',
process.version, true)
.addField('Voice Connections',
`${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',
"[cleverbot-node](https://github.com/fojas/cleverbot-node), [pirate-speak](https://github.com/mikewesthad/pirate-speak), [google-translate-api](https://github.com/matheuss/google-translate-api), [urban](https://github.com/mvrilo/urban), [zalgoize](https://github.com/clux/zalgolize), [hepburn](https://github.com/lovell/hepburn), [yahoo-weather](https://github.com/mamal72/node-yahoo-weather), [imdb-api](https://github.com/worr/node-imdb-api), [string-to-binary](https://www.npmjs.com/package/string-to-binary), [roman-numeral-converter-mmxvi](https://github.com/Cein-Markey/roman-numeral-conversion-library), [cowsay](https://github.com/piuccio/cowsay), [morse](https://github.com/ecto/morse)")
.addField('Utility Modules',
"[superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [opusscript](https://github.com/abalabahaha/opusscript), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/)")
.addField('APIs',
"[Cleverbot API](https://www.cleverbot.com/api/), [Wattpad API](https://developer.wattpad.com/docs/api), [Wordnik API](http://developer.wordnik.com/docs.html), [osu! API](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices API](http://docs.yugiohprices.apiary.io/#), [YouTube Data API](https://developers.google.com/youtube/v3/), [Yoda Speak API](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots API](https://bots.discord.pw/api), [Today in History API](http://history.muffinlabs.com/#api)")
.addField('Other Credit',
"[Heroku](https://www.heroku.com/), [Cloud9](https://c9.io/), [heroku-buildpack-ffmpeg-latest](https://elements.heroku.com/buildpacks/jonathanong/heroku-buildpack-ffmpeg-latest)")
.addField('My Server',
"[Click Here to Join!](https://discord.gg/fqQF8mc)")
.addField('Invite Link:',
"[Click Here to Add Me to Your Server!](https://discordapp.com/oauth2/authorize?client_id=278305350804045834&scope=bot&permissions=1345846343)");
return message.channel.sendEmbed(embed).catch(console.error);
});
});
let guilds = await this.client.shard.fetchClientValues('guilds.size');
let vCConnections = await this.client.shard.fetchClientValues('voiceConnections.size');
const embed = new Discord.RichEmbed()
.setTitle('Welcome to XiaoBot!')
.setAuthor(this.client.user.username, this.client.user.avatarURL)
.setColor(0x00AE86)
.setDescription('XiaoBot is your personal companion for your Discord Server!')
.setFooter(`©2017 dragonfire535 | Created ${moment.duration(this.client.user.createdTimestamp - Date.now()).format('y[ years], M[ months], w[ weeks, and ]d[ days]')} ago!`)
.setThumbnail(this.client.user.avatarURL)
.setURL('http://dragonfire535.weebly.com/xiaobot.html')
.addField('Commands',
"There are a variety of commands XiaoBot can use! Use ';help' to view a list of all commands!")
.addField('Servers',
`${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)
.addField('Owner',
"dragonfire535#8081", true)
.addField('Source Code',
"[View Here](https://github.com/dragonfire535/xiaobot)", true)
.addField('Memory Usage',
`${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)}MB`, true)
.addField('Uptime',
moment.duration(this.client.uptime).format('d[d]h[h]m[m]s[s]'), true)
.addField('Node Version',
process.version, true)
.addField('Voice Connections',
`${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',
"[cleverbot-node](https://github.com/fojas/cleverbot-node), [pirate-speak](https://github.com/mikewesthad/pirate-speak), [google-translate-api](https://github.com/matheuss/google-translate-api), [urban](https://github.com/mvrilo/urban), [zalgoize](https://github.com/clux/zalgolize), [hepburn](https://github.com/lovell/hepburn), [yahoo-weather](https://github.com/mamal72/node-yahoo-weather), [imdb-api](https://github.com/worr/node-imdb-api), [string-to-binary](https://www.npmjs.com/package/string-to-binary), [roman-numeral-converter-mmxvi](https://github.com/Cein-Markey/roman-numeral-conversion-library), [cowsay](https://github.com/piuccio/cowsay), [morse](https://github.com/ecto/morse)")
.addField('Utility Modules',
"[superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [opusscript](https://github.com/abalabahaha/opusscript), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/)")
.addField('APIs',
"[Cleverbot API](https://www.cleverbot.com/api/), [Wattpad API](https://developer.wattpad.com/docs/api), [Wordnik API](http://developer.wordnik.com/docs.html), [osu! API](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices API](http://docs.yugiohprices.apiary.io/#), [YouTube Data API](https://developers.google.com/youtube/v3/), [Yoda Speak API](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots API](https://bots.discord.pw/api), [Today in History API](http://history.muffinlabs.com/#api)")
.addField('Other Credit',
"[Heroku](https://www.heroku.com/), [Cloud9](https://c9.io/), [heroku-buildpack-ffmpeg-latest](https://elements.heroku.com/buildpacks/jonathanong/heroku-buildpack-ffmpeg-latest)")
.addField('My Server',
"[Click Here to Join!](https://discord.gg/fqQF8mc)")
.addField('Invite Link:',
"[Click Here to Add Me to Your Server!](https://discordapp.com/oauth2/authorize?client_id=278305350804045834&scope=bot&permissions=1345846343)");
let embededMessage = await message.channel.sendEmbed(embed);
}
};
+1 -1
View File
@@ -16,6 +16,6 @@ module.exports = class InviteCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
return 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");
let inviteMes = await 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");
}
};
+1 -1
View File
@@ -18,6 +18,6 @@ module.exports = class UptimeCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
return 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 **${this.client.guilds.size} Servers.**`);
let uptimeMes = await 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 **${this.client.guilds.size} Servers.**`);
}
};
+2 -2
View File
@@ -22,10 +22,10 @@ module.exports = class EmojiCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
if (message.channel.type !== 'dm') {
return message.channel.send(message.guild.emojis.map(e => e).join(" "));
let emojiMes = await message.channel.send(message.guild.emojis.map(e => e).join(" "));
}
else {
return message.channel.send(":x: Error! This command does not work in DM!");
let errorMessage = await message.channel.send(":x: Error! This command does not work in DM!");
}
}
};
+2 -2
View File
@@ -40,10 +40,10 @@ module.exports = class GuildInfoCommand extends commando.Command {
`${message.guild.owner.user.username}#${message.guild.owner.user.discriminator}`, true)
.addField("**Users:**",
message.guild.memberCount, true);
return message.channel.sendEmbed(embed).catch(console.error);
let embededMessage = await message.channel.sendEmbed(embed);
}
else {
return message.channel.send(":x: Error! This command does not work in DM!");
let errorMessage = await message.channel.send(":x: Error! This command does not work in DM!");
}
}
};
+12 -7
View File
@@ -119,7 +119,7 @@ module.exports = class MemeCommand extends commando.Command {
console.log(`[Command] ${message.content}`);
let [type] = message.content.toLowerCase().split(" ").slice(1);
if (type === "list") {
return message.channel.send("**Type Codes:** tenguy, afraid, older, aag, tried, biw, blb, kermit, bd, ch, cbg, wonka, cb, keanu, dsm, live, ants, doge, alwaysonbeat, ermg, facepalm, fwp, fa, fbf, fry, hipster, icanhas, crazypills, mw, noidea, regret, boat, hagrid, sohappy, captain, inigo, iw, ackbar, happening, joker, ive, ll, morpheus, mb, badchoice, mmm, jetpack, red, mordor, oprah, oag, remembers, philosoraptor, jw, patrick, rollsafe, sad-obama, sad-clinton, sadfrog, sad-bush, sad-biden, sad-boehner, saltbae, sarcasticbear, dwight, sb, ss, sf, dodgson, money, sohot, nice, awesome-awkward, awesome, awkward-awesome, awkward, fetch, success, scc, ski, officespace, interesting, toohigh, bs, center, both, winter, xy, buzz, yodawg, uno, yallgot, bad, elf, chosen");
let listMes = await message.channel.send("**Type Codes:** tenguy, afraid, older, aag, tried, biw, blb, kermit, bd, ch, cbg, wonka, cb, keanu, dsm, live, ants, doge, alwaysonbeat, ermg, facepalm, fwp, fa, fbf, fry, hipster, icanhas, crazypills, mw, noidea, regret, boat, hagrid, sohappy, captain, inigo, iw, ackbar, happening, joker, ive, ll, morpheus, mb, badchoice, mmm, jetpack, red, mordor, oprah, oag, remembers, philosoraptor, jw, patrick, rollsafe, sad-obama, sad-clinton, sadfrog, sad-bush, sad-biden, sad-boehner, saltbae, sarcasticbear, dwight, sb, ss, sf, dodgson, money, sohot, nice, awesome-awkward, awesome, awkward-awesome, awkward, fetch, success, scc, ski, officespace, interesting, toohigh, bs, center, both, winter, xy, buzz, yodawg, uno, yallgot, bad, elf, chosen");
}
else if (message.content.includes(" | ")) {
if (message.content.split(" ").slice(1).join(" ").match(/^[a-zA-Z0-9|.,!?'-\s]+$/)) {
@@ -128,26 +128,31 @@ module.exports = class MemeCommand extends commando.Command {
let bottomrow = memeQuery[1].split("?").join("~q");
let link = `https://memegen.link/${type}/${toprow}/${bottomrow}.jpg`;
if (bottomrow.length > 100) {
return message.channel.send(":x: Error! Bottom text is over 100 characters!");
let charErrMes1 = await message.channel.send(":x: Error! Bottom text is over 100 characters!");
}
else if (toprow.length > 100) {
return message.channel.send(":x: Error! Top text is over 100 characters!");
let charErrMes2 = await message.channel.send(":x: Error! Top text is over 100 characters!");
}
else {
if (memecodes[type]) {
return message.channel.sendFile(link).catch(error => message.channel.send(":x: An Error Occurred! Please try again later!"));
try {
let memeImg = await message.channel.sendFile(link);
}
catch (err) {
let errorMessage = await message.channel.send(":x: An Error Occurred! Please try again later!");
}
}
else {
return message.channel.send(":x: Error! Meme type not found! Use `;meme list` to view of list of meme codes!");
let listErr = await message.channel.send(":x: Error! Meme type not found! Use `;meme list` to view of list of meme codes!");
}
}
}
else {
return message.channel.send(":x: Error! Only letters, numbers, periods, commas, apostrophes, exclamation points, and question marks are allowed!");
let regexErr = await message.channel.send(":x: Error! Only letters, numbers, periods, commas, apostrophes, exclamation points, and question marks are allowed!");
}
}
else {
return message.channel.send(":x: Split your two choices with a ' | '!");
let splitErr = await message.channel.send(":x: Split your two choices with a ' | '!");
}
}
};
+8 -8
View File
@@ -24,13 +24,13 @@ module.exports = class BanCommand extends commando.Command {
let userToBan = message.mentions.users.first();
let reason = message.content.split(" ").slice(2).join(" ");
if (message.mentions.users.size !== 1) {
return message.channel.send(":x: Error! Please mention one user!");
let mentionError = await message.channel.send(":x: Error! Please mention one user!");
}
else {
if (message.member.hasPermission('BAN_MEMBERS')) {
if (message.guild.member(userToBan).bannable) {
await message.channel.send(":ok_hand:");
await message.guild.member(userToBan).ban();
let okHandMes = await message.channel.send(":ok_hand:");
let banMember = await message.guild.member(userToBan).ban();
if (message.guild.channels.exists("name", "mod_logs")) {
const embed = new Discord.RichEmbed()
.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL)
@@ -38,23 +38,23 @@ module.exports = class BanCommand extends commando.Command {
.setFooter('XiaoBot Moderation', this.client.user.avatarURL)
.setTimestamp()
.setDescription(`**Member:** ${userToBan.username}#${userToBan.discriminator} (${userToBan.id})\n**Action:** Ban\n**Reason:** ${reason}`);
return message.guild.channels.find('name', 'mod_logs').sendEmbed(embed).catch(console.error);
let modLog = await message.guild.channels.find('name', 'mod_logs').sendEmbed(embed);
}
else {
return message.channel.send(":notepad_spiral: **Note: No log will be sent, as there is not a channel named 'mod_logs'. Please create it to use the logging feature.**");
let modLogNote = await message.channel.send(":notepad_spiral: **Note: No log will be sent, as there is not a channel named 'mod_logs'. Please create it to use the logging feature.**");
}
}
else {
return message.channel.send(":x: Error! This member cannot be banned! Perhaps they have a higher role than me?");
let banErr = await message.channel.send(":x: Error! This member cannot be banned! Perhaps they have a higher role than me?");
}
}
else {
return message.channel.send(":x: Error! You don't have the Ban Members Permission!");
let permissionErr = await message.channel.send(":x: Error! You don't have the Ban Members Permission!");
}
}
}
else {
return message.channel.send(":x: Error! This command does not work in DM!");
let dmErr = await message.channel.send(":x: Error! This command does not work in DM!");
}
}
};
+8 -8
View File
@@ -21,13 +21,13 @@ module.exports = class KickCommand extends commando.Command {
let userToKick = message.mentions.users.first();
let reason = message.content.split(" ").slice(2).join(" ");
if (message.mentions.users.size !== 1) {
return message.channel.send(":x: Error! Please mention one user!");
let mentionError = await message.channel.send(":x: Error! Please mention one user!");
}
else {
if (message.member.hasPermission('KICK_MEMBERS')) {
if (message.guild.member(userToKick).kickable) {
await message.channel.send(":ok_hand:");
await message.guild.member(userToKick).kick();
let okHandMes = await message.channel.send(":ok_hand:");
let kickMember = await message.guild.member(userToKick).kick();
if (message.guild.channels.exists("name", "mod_logs")) {
const embed = new Discord.RichEmbed()
.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL)
@@ -35,23 +35,23 @@ module.exports = class KickCommand extends commando.Command {
.setFooter('XiaoBot Moderation', this.client.user.avatarURL)
.setTimestamp()
.setDescription(`**Member:** ${userToKick.username}#${userToKick.discriminator} (${userToKick.id})\n**Action:** Kick\n**Reason:** ${reason}`);
return message.guild.channels.find('name', 'mod_logs').sendEmbed(embed).catch(console.error);
let modLog = await message.guild.channels.find('name', 'mod_logs').sendEmbed(embed).catch(console.error);
}
else {
return message.channel.send(":notepad_spiral: **Note: No log will be sent, as there is not a channel named 'mod_logs'. Please create it to use the logging feature.**");
let modLogNote = await message.channel.send(":notepad_spiral: **Note: No log will be sent, as there is not a channel named 'mod_logs'. Please create it to use the logging feature.**");
}
}
else {
return message.channel.send(":x: Error! This member cannot be kicked! Perhaps they have a higher role than me?");
let kickErr = await message.channel.send(":x: Error! This member cannot be kicked! Perhaps they have a higher role than me?");
}
}
else {
return message.channel.send(":x: Error! You don't have the Kick Members Permission!");
let permissionErr = await message.channel.send(":x: Error! You don't have the Kick Members Permission!");
}
}
}
else {
return message.channel.send(":x: Error! This command does not work in DM!");
let dmErr = await message.channel.send(":x: Error! This command does not work in DM!");
}
}
};
+6 -6
View File
@@ -21,11 +21,11 @@ module.exports = class WarnCommand extends commando.Command {
let userToWarn = message.mentions.users.first();
let reason = message.content.split(" ").slice(2).join(" ");
if (message.mentions.users.size !== 1) {
return message.channel.send(":x: Error! Please mention one user!");
let mentionError = await message.channel.send(":x: Error! Please mention one user!");
}
else {
if (message.member.hasPermission('MANAGE_MESSAGES')) {
await message.channel.send(":ok_hand:");
let okHandMes = await message.channel.send(":ok_hand:");
if (message.guild.channels.exists("name", "mod_logs")) {
const embed = new Discord.RichEmbed()
.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL)
@@ -33,19 +33,19 @@ module.exports = class WarnCommand extends commando.Command {
.setFooter('XiaoBot Moderation', this.client.user.avatarURL)
.setTimestamp()
.setDescription(`**Member:** ${userToWarn.username}#${userToWarn.discriminator} (${userToWarn.id})\n**Action:** Warn\n**Reason:** ${reason}`);
return message.guild.channels.find('name', 'mod_logs').sendEmbed(embed).catch(console.error);
let modLog = await message.guild.channels.find('name', 'mod_logs').sendEmbed(embed).catch(console.error);
}
else {
return message.channel.send("**Note: No log will be sent, as there is not a channel named 'mod_logs'. Please create it to use the logging feature.**");
let modLogNote = await message.channel.send("**Note: No log will be sent, as there is not a channel named 'mod_logs'. Please create it to use the logging feature.**");
}
}
else {
return message.channel.send(":x: Error! You don't have the Manage Messages Permission!");
let permissionErr = await message.channel.send(":x: Error! You don't have the Manage Messages Permission!");
}
}
}
else {
return message.channel.send(":x: Error! This command does not work in DM!");
let dmErr = await message.channel.send(":x: Error! This command does not work in DM!");
}
}
};
+7 -2
View File
@@ -26,10 +26,15 @@ module.exports = class MathCommand extends commando.Command {
let expression = message.content.split(" ").slice(1).join(" ");
try {
let solved = math.eval(expression);
return message.channel.send(solved).catch(error => message.channel.send(":x: Error! Invalid statement!"));
try {
let solvedMes = await message.channel.send(solved);
}
catch (err) {
let invalidErr1 = await message.channel.send(":x: Error! Invalid statement!");
}
}
catch (err) {
return message.channel.send(":x: Error! Invalid statement!");
let invalidErr2 = await message.channel.send(":x: Error! Invalid statement!");
}
}
};
+7 -2
View File
@@ -20,10 +20,15 @@ module.exports = class RomanCommand extends commando.Command {
let numberToRoman = message.content.split(" ").slice(1).join(" ");
let romanInterger = Number(numberToRoman);
if (romanInterger > 1000000) {
return message.channel.send(':x: Error! Number is too high!');
let numberErr = await message.channel.send(':x: Error! Number is too high!');
}
else {
return message.channel.send(romanNumeralConverter.getRomanFromInteger(romanInterger)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered nothing?'));
try {
let romanMes = await message.channel.send(romanNumeralConverter.getRomanFromInteger(romanInterger));
}
catch (err) {
let errMes = await message.channel.send(':x: Error! Something went wrong! Perhaps you entered nothing?');
}
}
}
};