Prefix Change and General Code Improvements

This commit is contained in:
Daniel Odendahl Jr
2017-04-17 15:33:20 +00:00
parent 75ad7fecaa
commit fd221e6f56
20 changed files with 29 additions and 30 deletions
+2 -2
View File
@@ -35,9 +35,9 @@ module.exports = class YearsCommand extends Command {
const [avatar, years] = await Promise.all(images); const [avatar, years] = await Promise.all(images);
avatar.resize(200, 200); avatar.resize(200, 200);
years.blit(avatar, 461, 127); years.blit(avatar, 461, 127);
years.getBuffer(Jimp.MIME_PNG, (err, buff) => { return years.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say(':x: Error! Something went wrong!'); if (err) return message.say(':x: Error! Something went wrong!');
return message.channel.sendFile(buff); return message.channel.send({file: buff});
}); });
} }
}; };
+2 -2
View File
@@ -37,9 +37,9 @@ module.exports = class BeautifulCommand extends Command {
beautiful.blit(avatar, 432, 42); beautiful.blit(avatar, 432, 42);
avatar.resize(190, 190); avatar.resize(190, 190);
beautiful.blit(avatar, 451, 434); beautiful.blit(avatar, 451, 434);
beautiful.getBuffer(Jimp.MIME_PNG, (err, buff) => { return beautiful.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say(':x: Error! Something went wrong!'); if (err) return message.say(':x: Error! Something went wrong!');
return message.channel.sendFile(buff); return message.channel.send({file: buff});
}); });
} }
}; };
+2 -2
View File
@@ -39,9 +39,9 @@ module.exports = class BobRossCommand extends Command {
avatar.resize(300, 300); avatar.resize(300, 300);
nothing.composite(avatar, 44, 85); nothing.composite(avatar, 44, 85);
nothing.composite(bob, 0, 0); nothing.composite(bob, 0, 0);
nothing.getBuffer(Jimp.MIME_PNG, (err, buff) => { return nothing.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say(':x: Error! Something went wrong!'); if (err) return message.say(':x: Error! Something went wrong!');
return message.channel.sendFile(buff); return message.channel.send({file: buff});
}); });
} }
}; };
+2 -2
View File
@@ -36,9 +36,9 @@ module.exports = class RIPCommand extends Command {
const [avatar, gravestone] = await Promise.all(images); const [avatar, gravestone] = await Promise.all(images);
avatar.resize(200, 200); avatar.resize(200, 200);
gravestone.blit(avatar, 60, 65); gravestone.blit(avatar, 60, 65);
gravestone.getBuffer(Jimp.MIME_PNG, (err, buff) => { return gravestone.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say(':x: Error! Something went wrong!'); if (err) return message.say(':x: Error! Something went wrong!');
return message.channel.sendFile(buff); return message.channel.send({file: buff});
}); });
} }
}; };
+2 -2
View File
@@ -40,9 +40,9 @@ module.exports = class SteamCardCommand extends Command {
nothing.composite(avatar, 25, 25); nothing.composite(avatar, 25, 25);
nothing.composite(steamcard, 0, 0); nothing.composite(steamcard, 0, 0);
nothing.print(font, 38, 20, userDisplayName); nothing.print(font, 38, 20, userDisplayName);
nothing.getBuffer(Jimp.MIME_PNG, (err, buff) => { return nothing.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say(':x: Error! Something went wrong!'); if (err) return message.say(':x: Error! Something went wrong!');
return message.channel.sendFile(buff); return message.channel.send({file: buff});
}); });
} }
}; };
+1 -1
View File
@@ -58,6 +58,6 @@ module.exports = class MemeCommand extends Command {
let bottomrow = args.bottomrow.replace(/[ ]/g, '-'); let bottomrow = args.bottomrow.replace(/[ ]/g, '-');
bottomrow = bottomrow.replace(/[?]/g, '~q'); bottomrow = bottomrow.replace(/[?]/g, '~q');
const link = `https://memegen.link/${type}/${toprow}/${bottomrow}.jpg`; const link = `https://memegen.link/${type}/${toprow}/${bottomrow}.jpg`;
return message.channel.sendFile(link).catch(() => message.say(':x: Error! Something went wrong!')); return message.channel.send({file: link}).catch(() => message.say(':x: Error! Something went wrong!'));
} }
}; };
+2 -2
View File
@@ -48,14 +48,14 @@ module.exports = class BanCommand extends Command {
const reason = args.reason; const reason = args.reason;
if (!member.bannable) return message.say(':x: Error! This member cannot be banned! Perhaps they have a higher role than me?'); if (!member.bannable) return message.say(':x: Error! This member cannot be banned! Perhaps they have a higher role than me?');
try { try {
await member.ban(); await member.ban(7);
await message.say(':ok_hand:'); await message.say(':ok_hand:');
const embed = new RichEmbed() const embed = new RichEmbed()
.setAuthor(message.author.tag, message.author.avatarURL) .setAuthor(message.author.tag, message.author.avatarURL)
.setColor(0xFF0000) .setColor(0xFF0000)
.setTimestamp() .setTimestamp()
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Ban\n**Reason:** ${reason}`); .setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Ban\n**Reason:** ${reason}`);
return message.guild.channels.find('name', 'mod_logs').sendEmbed(embed); return message.guild.channels.find('name', 'mod_logs').send({embed});
} }
catch (err) { catch (err) {
return message.say(':x: Error! Something went wrong!'); return message.say(':x: Error! Something went wrong!');
+1 -1
View File
@@ -52,7 +52,7 @@ module.exports = class KickCommand extends Command {
.setColor(0xFFA500) .setColor(0xFFA500)
.setTimestamp() .setTimestamp()
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Kick\n**Reason:** ${reason}`); .setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Kick\n**Reason:** ${reason}`);
return message.guild.channels.find('name', 'mod_logs').sendEmbed(embed); return message.guild.channels.find('name', 'mod_logs').send({embed});
} }
catch (err) { catch (err) {
return message.say(':x: Error! Something went wrong!'); return message.say(':x: Error! Something went wrong!');
+1 -1
View File
@@ -60,7 +60,7 @@ module.exports = class UnbanCommand extends Command {
.setColor(0x00AE86) .setColor(0x00AE86)
.setTimestamp() .setTimestamp()
.setDescription(`**Member:** ${unbanUser.tag} (${unbanUser.id})\n**Action:** Unban\n**Reason:** ${reason}`); .setDescription(`**Member:** ${unbanUser.tag} (${unbanUser.id})\n**Action:** Unban\n**Reason:** ${reason}`);
return message.guild.channels.find('name', 'mod_logs').sendEmbed(embed); return message.guild.channels.find('name', 'mod_logs').send({embed});
} }
catch (err) { catch (err) {
return message.say(':x: Error! Something went wrong!'); return message.say(':x: Error! Something went wrong!');
+1 -1
View File
@@ -49,7 +49,7 @@ module.exports = class WarnCommand extends Command {
.setColor(0xFFFF00) .setColor(0xFFFF00)
.setTimestamp() .setTimestamp()
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Warn\n**Reason:** ${reason}`); .setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Warn\n**Reason:** ${reason}`);
return message.guild.channels.find('name', 'mod_logs').sendEmbed(embed); return message.guild.channels.find('name', 'mod_logs').send({embed});
} }
catch (err) { catch (err) {
return message.say(':x: Error! Something went wrong!'); return message.say(':x: Error! Something went wrong!');
+1 -1
View File
@@ -16,6 +16,6 @@ module.exports = class SpamCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES')) return message.say(':x: Error! I don\'t have the Attach Files Permission!'); if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES')) return message.say(':x: Error! I don\'t have the Attach Files Permission!');
} }
return message.channel.sendFile('./images/Spam.jpg'); return message.channel.send({file: './images/Spam.jpg'});
} }
}; };
+1 -1
View File
@@ -18,6 +18,6 @@ module.exports = class CatCommand extends Command {
} }
let cat = ['1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg', '7.jpg', '8.jpg', '9.jpg', '10.jpg', '11.jpeg', '12.jpg', '13.jpeg', '14.png', '15.jpg', '16.jpg', '17.jpg', '18.jpg', '19.jpg', '20.jpg']; let cat = ['1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg', '7.jpg', '8.jpg', '9.jpg', '10.jpg', '11.jpeg', '12.jpg', '13.jpeg', '14.png', '15.jpg', '16.jpg', '17.jpg', '18.jpg', '19.jpg', '20.jpg'];
cat = cat[Math.floor(Math.random() * cat.length)]; cat = cat[Math.floor(Math.random() * cat.length)];
return message.channel.sendFile(`./images/Cat${cat}`); return message.channel.send({file: `./images/Cat${cat}`});
} }
}; };
+1 -1
View File
@@ -21,6 +21,6 @@ module.exports = class PotatoCommand extends Command {
} }
let potato = ['1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.gif', '6.png', '7.jpg', '8.jpg', '9.jpg']; let potato = ['1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.gif', '6.png', '7.jpg', '8.jpg', '9.jpg'];
potato = potato[Math.floor(Math.random() * potato.length)]; potato = potato[Math.floor(Math.random() * potato.length)];
return message.channel.sendFile(`./images/Potato${potato}`); return message.channel.send({file: `./images/Potato${potato}`});
} }
}; };
+1 -1
View File
@@ -18,6 +18,6 @@ module.exports = class RandomPunCommand extends Command {
} }
let pun = ['1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg', '7.jpg', '8.png', '9.jpg', '10.jpg', '11.jpg', '12.jpg', '13.jpg', '14.jpg', '15.jpg', '16.jpg', '17.jpg', '18.jpg', '19.jpg', '20.jpg', '21.jpg', '22.jpg', '23.jpg', '24.jpg', '25.jpg', '26.jpg', '27.jpg', '28.jpg', '29.jpg', '30.jpeg', '31.jpg', '32.jpg', '33.jpg', '34.png', '35.jpg', '36.jpg', '37.jpg', '38.jpg', '39.jpg', '40.jpg', '41.jpg', '42.jpg', '43.jpg', '44.jpg', '45.gif', '46.jpg', '47.jpg', '48.jpg', '49.jpg', '50.jpg', '51.jpg', '52.jpg', '53.jpg']; let pun = ['1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg', '7.jpg', '8.png', '9.jpg', '10.jpg', '11.jpg', '12.jpg', '13.jpg', '14.jpg', '15.jpg', '16.jpg', '17.jpg', '18.jpg', '19.jpg', '20.jpg', '21.jpg', '22.jpg', '23.jpg', '24.jpg', '25.jpg', '26.jpg', '27.jpg', '28.jpg', '29.jpg', '30.jpeg', '31.jpg', '32.jpg', '33.jpg', '34.png', '35.jpg', '36.jpg', '37.jpg', '38.jpg', '39.jpg', '40.jpg', '41.jpg', '42.jpg', '43.jpg', '44.jpg', '45.gif', '46.jpg', '47.jpg', '48.jpg', '49.jpg', '50.jpg', '51.jpg', '52.jpg', '53.jpg'];
pun = pun[Math.floor(Math.random() * pun.length)]; pun = pun[Math.floor(Math.random() * pun.length)];
return message.channel.sendFile(`./images/Pun${pun}`); return message.channel.send({file: `./images/Pun${pun}`});
} }
}; };
+1 -1
View File
@@ -21,6 +21,6 @@ module.exports = class XiaoCommand extends Command {
} }
let xiao = ['1.png', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg', '7.jpg', '8.png', '9.png', '10.png', '11.png', '12.png', '13.jpg', '14.jpg', '15.png', '16.jpg', '17.png', '18.gif', '19.png', '20.jpg', '21.jpg']; let xiao = ['1.png', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg', '7.jpg', '8.png', '9.png', '10.png', '11.png', '12.png', '13.jpg', '14.jpg', '15.png', '16.jpg', '17.png', '18.gif', '19.png', '20.jpg', '21.jpg'];
xiao = xiao[Math.floor(Math.random() * xiao.length)]; xiao = xiao[Math.floor(Math.random() * xiao.length)];
return message.channel.sendFile(`./images/Xiao${xiao}`); return message.channel.send({file: `./images/Xiao${xiao}`});
} }
}; };
+1 -1
View File
@@ -40,7 +40,7 @@ module.exports = class MapCommand extends Command {
try { try {
const response = await snekfetch const response = await snekfetch
.get(`https://maps.googleapis.com/maps/api/staticmap?center=${location}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`); .get(`https://maps.googleapis.com/maps/api/staticmap?center=${location}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`);
return message.channel.sendFile(response.body); return message.channel.send({file: response.body});
} }
catch (err) { catch (err) {
return message.say(':x: Error! Something went wrong! Make sure you entered the location correctly!'); return message.say(':x: Error! Something went wrong! Make sure you entered the location correctly!');
+1 -1
View File
@@ -12,7 +12,7 @@
<h2>Notes:</h2> <h2>Notes:</h2>
<ol> <ol>
<li>Moderation Commands Require a Channel Named "mod_logs" to send Ban/Kick/Unban/Warn Logs</li> <li>Moderation Commands Require a Channel Named "mod_logs" to send Ban/Kick/Unban/Warn Logs</li>
<li>Use ;help to View a Command List</li> <li>Use x;help to View a Command List</li>
<li>Visit my <a href="https://discord.gg/fqQF8mc">Home Server</a> for more support, or for updates, or if you just want to hang out.</li> <li>Visit my <a href="https://discord.gg/fqQF8mc">Home Server</a> for more support, or for updates, or if you just want to hang out.</li>
</ol> </ol>
</div> </div>
+1 -1
View File
@@ -55,7 +55,7 @@
<h2>Notes:</h2> <h2>Notes:</h2>
<ol> <ol>
<li>Moderation Commands Require a Channel Named "mod_logs" to send Ban/Kick/Unban/Warn Logs</li> <li>Moderation Commands Require a Channel Named "mod_logs" to send Ban/Kick/Unban/Warn Logs</li>
<li>Use ;help to View a Command List</li> <li>Use x;help to View a Command List</li>
<li>Visit my <a href="https://discord.gg/fqQF8mc">Home Server</a> for more support, or for updates, or if you just want to hang out.</li> <li>Visit my <a href="https://discord.gg/fqQF8mc">Home Server</a> for more support, or for updates, or if you just want to hang out.</li>
</ol> </ol>
<h2>Modules</h2> <h2>Modules</h2>
+2 -3
View File
@@ -2,8 +2,7 @@ const commando = require('discord.js-commando');
const snekfetch = require('snekfetch'); const snekfetch = require('snekfetch');
const path = require('path'); const path = require('path');
const client = new commando.Client({ const client = new commando.Client({
commandPrefix: ';', commandPrefix: 'x;',
unknownCommandResponse: false,
owner: process.env.OWNER_ID, owner: process.env.OWNER_ID,
disableEveryone: true disableEveryone: true
}); });
@@ -108,7 +107,7 @@ client.setTimeout(() => {
client.on('ready', () => { client.on('ready', () => {
console.log(`[Ready] Shard ${client.shard.id} Logged in!`); console.log(`[Ready] Shard ${client.shard.id} Logged in!`);
client.user.setGame(`;help | Shard ${client.shard.id}`); client.user.setGame(`x;help | Shard ${client.shard.id}`);
}); });
process.on('unhandledRejection', console.error); process.on('unhandledRejection', console.error);
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiaobot", "name": "xiaobot",
"version": "25.4.0", "version": "26.0.0",
"description": "A Discord Bot", "description": "A Discord Bot",
"main": "shardingmanager.js", "main": "shardingmanager.js",
"scripts": { "scripts": {
@@ -33,10 +33,10 @@
"discord.js": "hydrabolt/discord.js", "discord.js": "hydrabolt/discord.js",
"discord.js-commando": "gawdl3y/discord.js-commando", "discord.js-commando": "gawdl3y/discord.js-commando",
"jimp": "^0.2.27", "jimp": "^0.2.27",
"mathjs": "^3.11.0", "mathjs": "^3.11.5",
"moment": "^2.18.1", "moment": "^2.18.1",
"moment-duration-format": "^1.3.0", "moment-duration-format": "^1.3.0",
"snekfetch": "^2.2.3", "snekfetch": "^2.3.2",
"zalgolize": "^1.2.4" "zalgolize": "^1.2.4"
} }
} }