This commit is contained in:
Daniel Odendahl Jr
2017-06-09 02:32:10 +00:00
parent 78d6e1eed1
commit 300411824d
25 changed files with 47 additions and 42 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ module.exports = class YearsCommand extends Command {
async run(msg, args) {
const user = args.user || msg.author;
const avatarURL = user.displayAvatarURL({
format: 'png',
format: 'png',
size: 256
});
const Image = Canvas.Image;
+1 -1
View File
@@ -32,7 +32,7 @@ module.exports = class BeautifulCommand extends Command {
async run(msg, args) {
const user = args.user || msg.author;
const avatarURL = user.displayAvatarURL({
format: 'png',
format: 'png',
size: 256
});
const Image = Canvas.Image;
+1 -1
View File
@@ -32,7 +32,7 @@ module.exports = class BobRossCommand extends Command {
async run(msg, args) {
const user = args.user || msg.author;
const avatarURL = user.displayAvatarURL({
format: 'png',
format: 'png',
size: 256
});
const Image = Canvas.Image;
+1 -1
View File
@@ -35,7 +35,7 @@ module.exports = class CardCommand extends Command {
async run(msg, args) {
const member = args.member || msg.member;
const avatarURL = member.user.displayAvatarURL({
format: 'png',
format: 'png',
size: 256
});
const cardID = Math.floor(Math.random() * (9999 - 1000 + 1)) + 1000;
+1 -1
View File
@@ -31,7 +31,7 @@ module.exports = class ChallengerCommand extends Command {
async run(msg, args) {
const user = args.user || msg.author;
const avatarURL = user.displayAvatarURL({
format: 'png',
format: 'png',
size: 256
});
const Image = Canvas.Image;
+1 -1
View File
@@ -31,7 +31,7 @@ module.exports = class DexterCommand extends Command {
async run(msg, args) {
const user = args.user || msg.author;
const avatarURL = user.displayAvatarURL({
format: 'png',
format: 'png',
size: 256
});
const Image = Canvas.Image;
+1 -1
View File
@@ -29,7 +29,7 @@ module.exports = class GreyscaleCommand extends Command {
async run(msg, args) {
const user = args.user || msg.author;
const avatarURL = user.displayAvatarURL({
format: 'png',
format: 'png',
size: 256
});
const Image = Canvas.Image;
+1 -1
View File
@@ -28,7 +28,7 @@ module.exports = class InvertCommand extends Command {
async run(msg, args) {
const user = args.user || msg.author;
const avatarURL = user.displayAvatarURL({
format: 'png',
format: 'png',
size: 256
});
const Image = Canvas.Image;
+1 -1
View File
@@ -32,7 +32,7 @@ module.exports = class RIPCommand extends Command {
async run(msg, args) {
const user = args.user || msg.author;
const avatarURL = user.displayAvatarURL({
format: 'png',
format: 'png',
size: 256
});
const Image = Canvas.Image;
+1 -1
View File
@@ -31,7 +31,7 @@ module.exports = class SimbaCommand extends Command {
async run(msg, args) {
const user = args.user || msg.author;
const avatarURL = user.displayAvatarURL({
format: 'png',
format: 'png',
size: 256
});
const Image = Canvas.Image;
+2 -2
View File
@@ -31,8 +31,8 @@ module.exports = class SteamCardCommand extends Command {
async run(msg, args) {
const user = args.user || msg.author;
const avatarURL = user.displayAvatarURL({
format: 'png',
size: 256
format: 'png',
size: 512
});
const Image = Canvas.Image;
Canvas.registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Roboto.ttf'), { family: 'Roboto' }); // eslint-disable-line max-len
+2 -2
View File
@@ -31,8 +31,8 @@ module.exports = class TriggeredCommand extends Command {
async run(msg, args) {
const user = args.user || msg.author;
const avatarURL = user.displayAvatarURL({
format: 'png',
size: 256
format: 'png',
size: 512
});
const Image = Canvas.Image;
const canvas = new Canvas(320, 371);
+2 -2
View File
@@ -31,8 +31,8 @@ module.exports = class WantedCommand extends Command {
async run(msg, args) {
const user = args.user || msg.author;
const avatarURL = user.displayAvatarURL({
format: 'png',
size: 256
format: 'png',
size: 512
});
const Image = Canvas.Image;
const canvas = new Canvas(741, 1000);
+6 -2
View File
@@ -101,8 +101,12 @@ module.exports = class BattleCommand extends Command {
this.fighting.delete(msg.guild.id);
return msg.say(stripIndents`
The match is over!
**Winner:** ${userHP > oppoHP ? `${msg.author.username} (${userHP}HP)` : `${opponent.username} (${oppoHP}HP)`}
**Loser:** ${userHP > oppoHP ? `${opponent.username} (${oppoHP}HP)` : `${msg.author.username} (${userHP}HP)`}
**Winner:** ${userHP > oppoHP ?
`${msg.author.username} (${userHP}HP)` :
`${opponent.username} (${oppoHP}HP)`}
**Loser:** ${userHP > oppoHP ?
`${opponent.username} (${oppoHP}HP)` :
`${msg.author.username} (${userHP}HP)`}
`);
}
};
+3 -4
View File
@@ -38,13 +38,12 @@ module.exports = class MathGameCommand extends Command {
.setTitle('You have 10 seconds to answer:')
.setDescription(expression);
await msg.embed(embed);
const collected = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
const msgs = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
max: 1,
time: 10000
});
if (!collected.size) return msg.say(`Time! It was ${answer}, sorry!`);
if (collected.first().content !== answer) return msg.say(`Nope, sorry, it's ${answer}.`);
if (!msgs.size) return msg.say(`Time! It was ${answer}, sorry!`);
if (msgs.first().content !== answer) return msg.say(`Nope, sorry, it's ${answer}.`);
else return msg.say('Nice job! 10/10! You deserve some cake!');
}
};
+3 -3
View File
@@ -31,12 +31,12 @@ module.exports = class QuizCommand extends Command {
True or False: ${decodeURIComponent(body.results[0].question)}
`);
await msg.embed(embed);
const collected = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
const msgs = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
max: 1,
time: 15000
});
if (!collected.size) return msg.say(`Time! It was ${answer}, sorry!`);
if (collected.first().content.toLowerCase() !== answer) return msg.say(`Nope, sorry, it's ${answer}.`);
if (!msgs.size) return msg.say(`Time! It was ${answer}, sorry!`);
if (msgs.first().content.toLowerCase() !== answer) return msg.say(`Nope, sorry, it's ${answer}.`);
else return msg.say('Nice job! 10/10! You deserve some cake!');
}
};
+3 -3
View File
@@ -33,12 +33,12 @@ module.exports = class TypingGameCommand extends Command {
.setTitle(`You have ${time / 1000} seconds to type:`)
.setDescription(sentence);
await msg.embed(embed);
const collected = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
const msgs = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
max: 1,
time
});
if (!collected.size) return msg.say('Time! Sorry!');
if (collected.first().content !== sentence) return msg.say('Nope, sorry!');
if (!msgs.size) return msg.say('Time! Sorry!');
if (msgs.first().content !== sentence) return msg.say('Nope, sorry!');
else return msg.say('Nice job! 10/10! You deserve some cake!');
}
};
+2 -2
View File
@@ -37,11 +37,11 @@ module.exports = class BanCommand extends Command {
const { member, reason } = args;
if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
await msg.say(`Are you sure you want to ban ${member.user.tag} (${member.id})?`);
const collected = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
const msgs = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
max: 1,
time: 15000
});
if (!collected.size || !['y', 'yes'].includes(collected.first().content.toLowerCase())) return msg.say('Aborting.');
if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return msg.say('Aborting.');
try {
await member.send(stripIndents`
You were banned from ${msg.guild.name}!
+2 -2
View File
@@ -37,11 +37,11 @@ module.exports = class KickCommand extends Command {
const { member, reason } = args;
if (!member.kickable) return msg.say('This member is not kickable. Perhaps they have a higher role than me?');
await msg.say(`Are you sure you want to kick ${member.user.tag} (${member.id})?`);
const collected = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
const msgs = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
max: 1,
time: 15000
});
if (!collected.size || !['y', 'yes'].includes(collected.first().content.toLowerCase())) return msg.say('Aborting.');
if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return msg.say('Aborting.');
try {
await member.send(stripIndents`
You were kicked from ${msg.guild.name}!
+2 -2
View File
@@ -37,11 +37,11 @@ module.exports = class SoftbanCommand extends Command {
const { member, reason } = args;
if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
await msg.say(`Are you sure you want to softban ${member.user.tag} (${member.id})?`);
const collected = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
const msgs = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
max: 1,
time: 15000
});
if (!collected.size || !['y', 'yes'].includes(collected.first().content.toLowerCase())) return msg.say('Aborting.');
if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return msg.say('Aborting.');
try {
await member.send(stripIndents`
You were softbanned from ${msg.guild.name}!
+2 -2
View File
@@ -39,11 +39,11 @@ module.exports = class UnbanCommand extends Command {
if (!bans.has(id)) return msg.say('This ID is not in the Guild Banlist.');
const member = bans.get(id).user;
await msg.say(`Are you sure you want to unban ${member.tag} (${member.id})?`);
const collected = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
const msgs = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
max: 1,
time: 15000
});
if (!collected.size || !['y', 'yes'].includes(collected.first().content.toLowerCase())) return msg.say('Aborting.');
if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return msg.say('Aborting.');
await msg.guild.unban(member, `${msg.author.tag}: ${reason}`);
await msg.say(`Successfully unbanned ${member.user.tag}.`);
if (!modlogs || !modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) {
+2 -2
View File
@@ -35,11 +35,11 @@ module.exports = class WarnCommand extends Command {
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
const { member, reason } = args;
await msg.say(`Are you sure you want to warn ${member.user.tag} (${member.id})?`);
const collected = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
const msgs = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
max: 1,
time: 15000
});
if (!collected.size || !['y', 'yes'].includes(collected.first().content.toLowerCase())) return msg.say('Aborting.');
if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return msg.say('Aborting.');
try {
await member.user.send(stripIndents`
You were warned in ${msg.guild.name}!
+4 -2
View File
@@ -25,9 +25,11 @@ module.exports = class StarCommand extends Command {
async run(msg, args, reaction) {
const { id } = args;
const channel = msg.guild.channels.get(msg.guild.settings.get('starboard'));
if (!channel || !channel.permissionsFor(this.client.user).has('SEND_MESSAGES') || this.starred.includes(id)) return null;
if (!channel ||
!channel.permissionsFor(this.client.user).has('SEND_MESSAGES') ||
this.starred.includes(id)) return null;
const message = await msg.channel.fetchMessage(id);
if (!reaction && msg.author.id === message.author.id) return msg.reply('You cannot star your own messages, baka.');
if (!reaction && msg.author.id === message.author.id) return msg.reply('You cannot star your own messages, baka.'); // eslint-disable-line max-len
this.starred.push(id);
if (!channel.permissionsFor(this.client.user).has('EMBED_LINKS')) {
return msg.say(stripIndents`
+1 -1
View File
@@ -43,7 +43,7 @@ module.exports = class HelpCommand extends Command {
commands[0].group.name);
return msg.embed(embed);
} else if (commands.length > 1) {
return msg.say(`Multiple commands found, please be more specific: ${commands.map((c) => c.name).join(', ')}`);
return msg.say(`Multiple commands found: ${commands.map((c) => c.name).join(', ')}`);
} else {
return msg.say(`Could not identify command. Use ${msg.usage(null)} to view a list of commands.`);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "22.1.5",
"version": "22.1.6",
"description": "A Discord Bot",
"main": "Shard.js",
"scripts": {