Code Improvements

This commit is contained in:
Daniel Odendahl Jr
2017-04-17 21:57:35 +00:00
parent 45ba18bea9
commit 9dd0589de5
46 changed files with 73 additions and 209 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ module.exports = class YearsCommand extends Command {
years.blit(avatar, 461, 127);
years.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say(':x: Error! Something went wrong!');
return message.channel.send({file: {attachment: buff} });
return message.channel.send({file: {attachment: buff}});
});
}
};
+1 -1
View File
@@ -39,7 +39,7 @@ module.exports = class BeautifulCommand extends Command {
beautiful.blit(avatar, 451, 434);
beautiful.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say(':x: Error! Something went wrong!');
return message.channel.send({file: {attachment: buff} });
return message.channel.send({file: {attachment: buff}});
});
}
};
+1 -1
View File
@@ -41,7 +41,7 @@ module.exports = class BobRossCommand extends Command {
nothing.composite(bob, 0, 0);
nothing.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say(':x: Error! Something went wrong!');
return message.channel.send({file: {attachment: buff} });
return message.channel.send({file: {attachment: buff}});
});
}
};
+1 -1
View File
@@ -38,7 +38,7 @@ module.exports = class RIPCommand extends Command {
gravestone.blit(avatar, 60, 65);
gravestone.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say(':x: Error! Something went wrong!');
return message.channel.send({file: {attachment: buff} });
return message.channel.send({file: {attachment: buff}});
});
}
};
+1 -1
View File
@@ -42,7 +42,7 @@ module.exports = class SteamCardCommand extends Command {
nothing.print(font, 38, 20, userDisplayName);
nothing.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say(':x: Error! Something went wrong!');
return message.channel.send({file: {attachment: buff} });
return message.channel.send({file: {attachment: buff}});
});
}
};
+2 -2
View File
@@ -15,9 +15,9 @@ module.exports = class LotteryCommand extends Command {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
const lottery = ['Winner'][Math.floor(Math.random() * 100)];
const lottery = Math.floor(Math.random() * 100) + 1;
const userName = message.author.username;
if (lottery !== 'Winner') return message.say(`Nope, sorry ${userName}, you lost.`);
if (lottery < 100) return message.say(`Nope, sorry ${userName}, you lost.`);
return message.say(`Wow ${userName}! You actually won! Great job!`);
}
};
+2 -3
View File
@@ -49,7 +49,7 @@ module.exports = class MathGameCommand extends Command {
}
const value1 = Math.floor(Math.random() * value) + 1;
const value2 = Math.floor(Math.random() * value) + 1;
const expression = value1 + operation + value2;
const expression = `${value1} ${operation}${value2}`;
const solved = math.eval(expression);
const embed = new RichEmbed()
.setTitle('You have **ten** seconds to answer:')
@@ -65,8 +65,7 @@ module.exports = class MathGameCommand extends Command {
return message.say(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`);
}
return message.say(`Good Job! You won! ${solved} is the correct answer!`);
}
catch (err) {
} catch (err) {
return message.say(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`);
}
}
+2 -4
View File
@@ -40,12 +40,10 @@ module.exports = class QuizCommand extends Command {
return message.say(`The correct answer is: ${answer}`);
}
return message.say(`Perfect! The correct answer is: ${answer}`);
}
catch (err) {
} catch (err) {
return message.say(`Aw... Too bad, try again next time!\nThe Correct Answer was: ${answer}`);
}
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Something went wrong!');
}
}
+2 -4
View File
@@ -36,13 +36,11 @@ module.exports = class RockPaperScissorsCommand extends Command {
if (response === 'Rock') return message.say('Rock! Aw, it\'s a tie!');
if (response === 'Paper') return message.say('Paper! Yes! I win!');
if (response === 'Scissors') return message.say('Scissors! Aw... I lose...');
}
else if (rps === 'paper') {
} else if (rps === 'paper') {
if (response === 'Rock') return message.say('Rock! Aw... I lose...');
if (response === 'Paper') return message.say('Paper! Aw, it\'s a tie!');
if (response === 'Scissors') return message.say('Scissors! Yes! I win!');
}
else if (rps === 'scissors') {
} else if (rps === 'scissors') {
if (response === 'Rock') return message.say('Rock! Yes! I win!');
if (response === 'Paper') return message.say('Paper! Aw... I lose...');
if (response === 'Scissors') return message.say('Scissors! Aw, it\'s a tie!');
+1 -3
View File
@@ -23,8 +23,6 @@ module.exports = class SlotsCommand extends Command {
if (slotOne === slotTwo && slotOne === slotThree && slotOne === slotFour) {
return message.say(`${slotOne}|${slotTwo}|${slotThree}|${slotFour}\nWow! You won! Great job... er... luck!`);
}
else {
return message.say(`${slotOne}|${slotTwo}|${slotThree}|${slotFour}\nAww... You lost... Guess it's just bad luck, huh?`);
}
return message.say(`${slotOne}|${slotTwo}|${slotThree}|${slotFour}\nAww... You lost... Guess it's just bad luck, huh?`);
}
};
+2 -3
View File
@@ -65,9 +65,8 @@ module.exports = class TypingGameCommand extends Command {
return message.say('Nope, your sentence does not match the original. Try again next time!');
}
return message.say(`Good Job! You won!`);
}
catch (err) {
return message.say('Aw... Too bad, try again next time!');
} catch (err) {
return message.say('Aw... Too bad, try again next time!');
}
}
};
+3 -5
View File
@@ -30,6 +30,7 @@ module.exports = class BanCommand extends Command {
}]
});
}
hasPermission(msg) {
return msg.member.hasPermission('BAN_MEMBERS');
}
@@ -42,9 +43,7 @@ module.exports = class BanCommand extends Command {
}
if (!message.guild.channels.exists('name', 'mod_logs')) return message.say(':x: Error! Could not find the mod_logs channel! Please create it!');
let member = message.guild.member(args.member);
if (!member) {
member = await message.guild.fetchMember(args.member);
}
if (!member) member = await message.guild.fetchMember(args.member);
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?');
try {
@@ -56,8 +55,7 @@ module.exports = class BanCommand extends Command {
.setTimestamp()
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Ban\n**Reason:** ${reason}`);
return message.guild.channels.find('name', 'mod_logs').send({embed});
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Something went wrong!');
}
}
+3 -5
View File
@@ -27,6 +27,7 @@ module.exports = class KickCommand extends Command {
}]
});
}
hasPermission(msg) {
return msg.member.hasPermission('KICK_MEMBERS');
}
@@ -39,9 +40,7 @@ module.exports = class KickCommand extends Command {
}
if (!message.guild.channels.exists('name', 'mod_logs')) return message.say(':x: Error! Could not find the mod_logs channel! Please create it!');
let member = message.guild.member(args.member);
if (!member) {
member = await message.guild.fetchMember(args.member);
}
if (!member) member = await message.guild.fetchMember(args.member);
const reason = args.reason;
if (!member.bannable) return message.say(':x: Error! This member cannot be kicked! Perhaps they have a higher role than me?');
try {
@@ -53,8 +52,7 @@ module.exports = class KickCommand extends Command {
.setTimestamp()
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Kick\n**Reason:** ${reason}`);
return message.guild.channels.find('name', 'mod_logs').send({embed});
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Something went wrong!');
}
}
+3 -4
View File
@@ -22,6 +22,7 @@ module.exports = class LockdownCommand extends Command {
}]
});
}
hasPermission(msg) {
return msg.member.hasPermission('ADMINISTRATOR');
}
@@ -38,8 +39,7 @@ module.exports = class LockdownCommand extends Command {
SEND_MESSAGES: false
});
return message.say('**Lockdown Started, users without Administrator can no longer post messages. Please use `;lockdown stop` to end the lockdown.**');
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Something went wrong!');
}
}
@@ -49,8 +49,7 @@ module.exports = class LockdownCommand extends Command {
SEND_MESSAGES: true
});
return message.say('**Lockdown Ended, users without Administrator can now post messages.**');
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Something went wrong!');
}
}
+2 -2
View File
@@ -34,6 +34,7 @@ module.exports = class PruneCommand extends Command {
}]
});
}
hasPermission(msg) {
return msg.member.hasPermission('MANAGE_MESSAGES');
}
@@ -51,8 +52,7 @@ module.exports = class PruneCommand extends Command {
});
await message.channel.bulkDelete(messages, true);
return null;
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Something went wrong! Perhaps there are not enough messages in the channel from earlier than two weeks?');
}
}
+2 -2
View File
@@ -36,6 +36,7 @@ module.exports = class UnbanCommand extends Command {
}]
});
}
hasPermission(msg) {
return msg.member.hasPermission('BAN_MEMBERS');
}
@@ -61,8 +62,7 @@ module.exports = class UnbanCommand extends Command {
.setTimestamp()
.setDescription(`**Member:** ${unbanUser.tag} (${unbanUser.id})\n**Action:** Unban\n**Reason:** ${reason}`);
return message.guild.channels.find('name', 'mod_logs').send({embed});
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Something went wrong!');
}
}
+3 -5
View File
@@ -27,6 +27,7 @@ module.exports = class WarnCommand extends Command {
}]
});
}
hasPermission(msg) {
return msg.member.hasPermission('MANAGE_MESSAGES');
}
@@ -37,9 +38,7 @@ module.exports = class WarnCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
}
let member = message.guild.member(args.member);
if (!member) {
member = await message.guild.fetchMember(args.member);
}
if (!member) member = await message.guild.fetchMember(args.member);
const reason = args.reason;
if (!message.guild.channels.exists('name', 'mod_logs')) return message.say(':x: Error! Could not find the mod_logs channel! Please create it!');
try {
@@ -50,8 +49,7 @@ module.exports = class WarnCommand extends Command {
.setTimestamp()
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Warn\n**Reason:** ${reason}`);
return message.guild.channels.find('name', 'mod_logs').send({embed});
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Something went wrong!');
}
}
+1 -2
View File
@@ -31,8 +31,7 @@ module.exports = class MathCommand extends Command {
try {
const solved = math.eval(expression);
return message.say(solved).catch(() => message.say(':x: Error! Invalid statement!'));
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Invalid statement!');
}
}
+1 -2
View File
@@ -34,8 +34,7 @@ module.exports = class TodayCommand extends Command {
.setTimestamp()
.setDescription(`${events[randomNumber].text} (${events[randomNumber].year})`);
return message.embed(embed);
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Something went wrong!');
}
}
+1 -2
View File
@@ -37,8 +37,7 @@ module.exports = class RandomNameCommand extends Command {
let name = ['Bob', 'Daniel', 'Logan', 'Chris', 'Nathan', 'George', 'Mart', 'Charlie', 'Felix', 'Ralph', 'William', 'Max', 'Jerry', 'Marty', 'Joshua', 'Cody', 'Richard', 'Alex', 'Alexander', 'Jordan', 'Zachary', 'Bill', 'Alfred', 'Bruce', 'Caiden', 'Calvin', 'Eric', 'Robert', 'Mark', 'Miles', 'Nash', 'Ronald', 'Ivan', 'Edgar', 'Royal', 'Augustine', 'Dominic', 'Noel', 'Rocky', 'Grover', 'Paul', 'Jeremy', 'Stevie', 'Brock', 'Jc', 'Tony', 'Enoch', 'Zachery', 'Harvey', 'Gilbert', 'Chang', 'Emery', 'Carroll', 'Odell', 'Jean', 'Archie', 'Russ', 'Barry', 'Lowell', 'Jacob', 'Riku', 'Frederic', 'Levi', 'Faustino', 'Leland', 'Domenic', 'Irwin', 'Moises', 'Louie', 'Larry', 'Victor'];
name = name[Math.floor(Math.random() * name.length)];
return message.say(`${name} ${lastName}`);
}
else if (gender === 'female') {
} else if (gender === 'female') {
let name = ['Elizabeth', 'Chelsey', 'Rachel', 'Logan', 'Alex', 'Jordan', 'Mary', 'Shirley', 'Sandy', 'Linda', 'Audrey', 'Autumn', 'Gracie', 'Grace', 'Erin', 'Catherine', 'Stephanie', 'Lucy', 'Patty', 'Julie', 'Christina', 'Fiona', 'Riley', 'Ashley', 'Bree', 'Lucila', 'Wendi', 'Evangelina', 'Ricki', 'Merna', 'Tegan', 'Venus', 'Claris', 'Tana', 'Sakura', 'Edythe', 'Adena', 'Princess', 'Elnora', 'Star', 'Edyth', 'Beverly', 'Kelsie', 'Letha', 'Latisha', 'Lolita', 'Bernandine', 'Jessenia', 'Hannah', 'Leonore', 'Alene', 'Fannie', 'Bernardine', 'Leena', 'Tera', 'Yvette', 'Melisa', 'Alissa', 'Xiao', 'Richelle', 'Bridgett', 'Sumiko', 'Paulette', 'Charlott', 'Honey', 'Veola', 'Sherita', 'Amanda', 'Vannessa', 'April', 'Ruth'];
name = name[Math.floor(Math.random() * name.length)];
return message.say(`${name} ${lastName}`);
+1 -2
View File
@@ -48,8 +48,7 @@ module.exports = class BotSearchCommand extends Command {
.addField('**Invite:**',
`[Here](${data.invite_url})`, true);
return message.embed(embed);
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Bot not Found!');
}
}
+1 -2
View File
@@ -39,8 +39,7 @@ module.exports = class DefineCommand extends Command {
.setTitle(data.word)
.setDescription(data.text);
return message.embed(embed);
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Word not Found!');
}
}
+1 -2
View File
@@ -52,8 +52,7 @@ module.exports = class ForecastCommand extends Command {
.addField(`**${data[6].day} - ${data[6].date}:**`,
`**High:** ${data[6].high}°F, **Low:** ${data[6].low}°F, **Condition:** ${data[6].text}`);
return message.embed(embed);
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Make sure you typed the location correctly!');
}
}
+1 -2
View File
@@ -35,8 +35,7 @@ module.exports = class GoogleCommand extends Command {
let href = $('.r').first().find('a').first().attr('href');
href = querystring.parse(href.replace('/url?', ''));
return msg.edit(href.q);
}
catch (err) {
} catch (err) {
return msg.edit(':x: Error! No Results Found!');
}
}
+1 -2
View File
@@ -54,8 +54,7 @@ module.exports = class IMDBCommand extends Command {
.addField('**Actors:**',
data.Actors);
return message.embed(embed);
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Movie not found!');
}
}
+2 -3
View File
@@ -40,9 +40,8 @@ module.exports = class MapCommand extends Command {
try {
const response = await snekfetch
.get(`https://maps.googleapis.com/maps/api/staticmap?center=${location}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`);
return message.channel.send({file: {attachment: response.body} });
}
catch (err) {
return message.channel.send({file: {attachment: response.body}});
} catch (err) {
return message.say(':x: Error! Something went wrong! Make sure you entered the location correctly!');
}
}
+1 -2
View File
@@ -31,8 +31,7 @@ module.exports = class NeopetCommand extends Command {
const link = $('textarea').first().text();
if (!link.includes('cp')) return message.say(':x: Error! Pet not found!');
return message.say(link);
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Something went wrong!');
}
}
+1 -2
View File
@@ -62,8 +62,7 @@ module.exports = class OsuCommand extends Command {
.addField('**A:**',
data.count_rank_a, true);
return message.embed(embed);
}
catch (err) {
} catch (err) {
return message.say(':x: Error! User not Found!');
}
}
-69
View File
@@ -1,69 +0,0 @@
const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const cheerio = require('cheerio');
module.exports = class PokedexCommand extends Command {
constructor(client) {
super(client, {
name: 'pokedex',
aliases: [
'pokemon'
],
group: 'search',
memberName: 'pokedex',
description: 'Gives the pokedex entry for a Pokemon. (;pokedex 001)',
examples: [';pokedex 001'],
args: [{
key: 'index',
prompt: 'What Pokémon would you like to get info on?',
type: 'integer',
validate: pokemon => {
if (pokemon < 803 && pokemon > 0) {
return true;
}
return 'Please enter a pokedex number from 001-802';
}
}]
});
}
async run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
}
let index = args.index;
let dex = 'xy';
let location = 'foox';
let location2 = 'fooy';
if (index > 721) {
dex = 'sm';
location = 'foosun';
location2 = 'foomoon';
}
index = index.toString();
const pad = '000'.slice(index.length);
index = `${pad}${index}`;
try {
const response = await snekfetch
.get(`http://www.serebii.net/pokedex-${dex}/${index}.shtml`);
const $ = cheerio.load(response.text);
const entry = $(`td.${location}`).eq(1).next().text();
const entry2 = $(`td.${location2}`).eq(1).next().text();
const embed = new RichEmbed()
.setAuthor(`#${index}`, `http://www.serebii.net/pokedex-sm/icon/${index}.png`)
.setColor(0xFF0000)
.setFooter('Pokédex', 'http://cdn.bulbagarden.net/upload/thumb/3/36/479Rotom-Pokédex.png/250px-479Rotom-Pokédex.png')
.setThumbnail(`http://www.serebii.net/sunmoon/pokemon/${index}.png`)
.addField('**Entry 1:**',
entry)
.addField('**Entry 2:**',
entry2);
return message.embed(embed);
}
catch (err) {
return message.say(':x: Error! Something went wrong!');
}
}
};
+1 -2
View File
@@ -42,8 +42,7 @@ module.exports = class UrbanCommand extends Command {
.addField('**Example:**',
data.example.substr(0, 1900) || 'None');
return message.embed(embed);
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Word not found!');
}
}
+1 -2
View File
@@ -50,8 +50,7 @@ module.exports = class WattpadCommand extends Command {
.addField('**Comments:**',
data.commentCount, true);
return message.embed(embed);
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Book not Found!');
}
}
+1 -2
View File
@@ -58,8 +58,7 @@ module.exports = class WeatherCommand extends Command {
.addField('**Wind Speed:**',
data.wind.speed, true);
return message.embed(embed);
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Make sure you typed the location correctly!');
}
}
+1 -2
View File
@@ -37,8 +37,7 @@ module.exports = class WikipediaCommand extends Command {
.setAuthor('Wikipedia', 'https://upload.wikimedia.org/wikipedia/en/thumb/8/80/Wikipedia-logo-v2.svg/1122px-Wikipedia-logo-v2.svg.png')
.setDescription(description);
return message.embed(embed);
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Entry Not Found!');
}
}
+1 -2
View File
@@ -39,8 +39,7 @@ module.exports = class YouTubeCommand extends Command {
.setURL(`https://www.youtube.com/watch?v=${data.id.videoId}`)
.setThumbnail(data.snippet.thumbnails.default.url);
return message.embed(embed);
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Something went wrong! Maybe no video was found?');
}
}
+1 -2
View File
@@ -56,8 +56,7 @@ module.exports = class YuGiOhCommand extends Command {
.addField('**Card Type:**',
data.card_type, true);
return message.embed(embed);
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Card not Found!\n:notepad_spiral: Note: This command is **extremely** sensitive to casing and dashes and whatnot. Type the *exact* card name to get data!');
}
}
+2 -2
View File
@@ -1,10 +1,10 @@
const { Command } = require('discord.js-commando');
const stringToBinary = (str) => {
const pad = "00000000";
const pad = '00000000';
return unescape(encodeURIComponent(str))
.split('').map(str => {
const binary = str.charCodeAt(0).toString(2);
return pad.slice(binary.length) + binary;
return `${pad.slice(binary.length)}${binary}`;
}).join('');
};
+2 -2
View File
@@ -21,6 +21,7 @@ module.exports = class WebhookCommand extends Command {
}]
});
}
hasPermission(msg) {
return this.client.isOwner(msg.author);
}
@@ -39,8 +40,7 @@ module.exports = class WebhookCommand extends Command {
content: text
});
return null;
}
catch (err) {
} catch (err) {
return message.say(':x: Error! Message failed to send!');
}
}
+2 -2
View File
@@ -19,7 +19,7 @@ module.exports = class InfoCommand extends Command {
});
}
async run(message, args) {
async run(message) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
@@ -33,7 +33,7 @@ module.exports = class InfoCommand extends Command {
.addField('Shards',
`${this.client.options.shardCount} (${this.client.shard.id})`, true)
.addField('Commands',
'108', true)
'106', true)
.addField('Owner',
'dragonfire535#8081', true)
.addField('Source Code',
-29
View File
@@ -1,29 +0,0 @@
const { Command } = require('discord.js-commando');
module.exports = class ServersCommand extends Command {
constructor(client) {
super(client, {
name: 'servers',
aliases: [
'serverlist'
],
group: 'util',
memberName: 'servers',
description: 'Sends a list of all server names and IDs to the log. (;servers)',
examples: [';servers']
});
}
hasPermission(msg) {
return this.client.isOwner(msg.author);
}
run(message) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
const guildCount = this.client.guilds.size;
const guildNames = this.client.guilds.map(g => `${g.name} (${g.id})`).join(', ');
console.log(`${guildCount} Servers: ${guildNames}`);
return message.say('Sent the information to the console!');
}
};
+1 -3
View File
@@ -32,9 +32,7 @@ module.exports = class ShardInfoCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
}
const shardID = args.shardID;
if (shardID > this.client.options.shardCount - 1 || shardID < 0) {
return message.say(':x: Error! Invalid Shard!');
}
if (shardID > this.client.options.shardCount - 1 || shardID < 0) return message.say(':x: Error! Invalid Shard!');
const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)');
const uptime = await this.client.shard.fetchClientValues('uptime');
const guilds = await this.client.shard.fetchClientValues('guilds.size');
+3 -1
View File
@@ -13,7 +13,9 @@
</marquee>
<h3></h3>
<div class="xiaobox">
<center><h1><a href="https://github.com/dragonfire535/xiaobot">Source Code</a></h1></center>
<center>
<h1><a href="https://github.com/dragonfire535/xiaobot">Source Code</a></h1>
</center>
<h2>Modules</h2>
<ul>
<li><a href="https://discord.js.org/#/">discord.js</a></li>
-1
View File
@@ -32,7 +32,6 @@
<li>Search IMDB</li>
<li>Get Neopet Images</li>
<li>Search for osu! Users</li>
<li>Pokédex</li>
<li>Search Urban Dictionary</li>
<li>Search YouTube for Videos</li>
<li>Search Wattpad for Books</li>
+3 -2
View File
@@ -13,7 +13,9 @@
</marquee>
<h3></h3>
<div class="xiaobox">
<center><h1><a href="https://github.com/dragonfire535/xiaobot">Source Code</a></h1></center>
<center>
<h1><a href="https://github.com/dragonfire535/xiaobot">Source Code</a></h1>
</center>
<h2>Features</h2>
<ul>
<li>Get User Info</li>
@@ -37,7 +39,6 @@
<li>Search IMDB</li>
<li>Get Neopet Images</li>
<li>Search for osu! Users</li>
<li>Pokédex</li>
<li>Search Urban Dictionary</li>
<li>Search YouTube for Videos</li>
<li>Search Wattpad for Books</li>
+6 -10
View File
@@ -1,7 +1,7 @@
const commando = require('discord.js-commando');
const { CommandoClient } = require('discord.js-commando');
const snekfetch = require('snekfetch');
const path = require('path');
const client = new commando.Client({
const client = new CommandoClient({
commandPrefix: 'x;',
owner: process.env.OWNER_ID,
disableEveryone: true
@@ -42,8 +42,7 @@ client.on('guildCreate', async(guild) => {
servercount: count
});
console.log(`[Carbon] Successfully posted to Carbon. ${response.text}`);
}
catch (err) {
} catch (err) {
console.log(`[Carbon] Failed to post to Carbon. ${err}`);
}
try {
@@ -56,8 +55,7 @@ client.on('guildCreate', async(guild) => {
server_count: count
});
console.log(`[Discord Bots] Successfully posted to Discord Bots. ${response.body.stats[0].server_count}`);
}
catch (err) {
} catch (err) {
console.log(`[Discord Bots] Failed to post to Discord Bots. ${err}`);
}
});
@@ -75,8 +73,7 @@ client.on('guildDelete', async(guild) => {
servercount: count
});
console.log(`[Carbon] Successfully posted to Carbon. ${response.text}`);
}
catch (err) {
} catch (err) {
console.log(`[Carbon] Failed to post to Carbon. ${err}`);
}
try {
@@ -89,8 +86,7 @@ client.on('guildDelete', async(guild) => {
server_count: count
});
console.log(`[Discord Bots] Successfully posted to Discord Bots. ${response.body.stats[0].server_count}`);
}
catch (err) {
} catch (err) {
console.log(`[Discord Bots] Failed to post to Discord Bots. ${err}`);
}
});
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "26.1.0",
"version": "27.0.0",
"description": "A Discord Bot",
"main": "shardingmanager.js",
"scripts": {
+3 -5
View File
@@ -1,7 +1,5 @@
const Discord = require('discord.js');
const Manager = new Discord.ShardingManager('./index.js', {
token: process.env.TOKEN
});
Manager.spawn();
const { ShardingManager } = require('discord.js');
const Manager = new ShardingManager('./index.js');
Manager.spawn(1);
process.on('unhandledRejection', console.error);