remove constants directory

This commit is contained in:
Emily 2020-11-10 14:31:49 +11:00
parent c297e45a64
commit 4d8eecff04
19 changed files with 74 additions and 79 deletions

View file

@ -1,5 +1,4 @@
const Embed = require('../../util/embed'); const prettified = require ('../../assets/categories.json');
const prettified = require ('../../assets/constants/categories.json');
module.exports = class { module.exports = class {
constructor (name, category) { constructor (name, category) {
@ -31,7 +30,7 @@ module.exports = class {
}); });
if (!args[0]) { if (!args[0]) {
const embed = new Embed(); const embed = new client.Richclient.RichEmbed();
embed.setTitle('Help & Commands'); embed.setTitle('Help & Commands');
embed.setColour(client.functions.displayHexColour(message.channel.guild, client.user.id)); embed.setColour(client.functions.displayHexColour(message.channel.guild, client.user.id));
embed.setDescription( embed.setDescription(
@ -65,7 +64,7 @@ module.exports = class {
cmds += `**${message.prefix + cmd.name}** ${params}${cmd.help.description}\n`; cmds += `**${message.prefix + cmd.name}** ${params}${cmd.help.description}\n`;
}); });
const embed = new Embed() const embed = new client.Richclient.RichEmbed()
.setTitle(prettified[cat].emoji + ' ' + cat) .setTitle(prettified[cat].emoji + ' ' + cat)
.setColour(client.functions.displayHexColour(message.channel.guild, client.user.id)) .setColour(client.functions.displayHexColour(message.channel.guild, client.user.id))
.setDescription(cmds) .setDescription(cmds)
@ -76,7 +75,7 @@ module.exports = class {
if (client.commands.has(cmd) || client.aliases.has(cmd)) { if (client.commands.has(cmd) || client.aliases.has(cmd)) {
const command = client.commands.get(cmd) || client.commands.get(client.aliases.get(cmd)); const command = client.commands.get(cmd) || client.commands.get(client.aliases.get(cmd));
const embed = new Embed() const embed = new client.Richclient.RichEmbed()
.setTitle(prettified[command.category].emoji + ' ' + command.category + ' -> ' + command.name.toProperCase()) .setTitle(prettified[command.category].emoji + ' ' + command.category + ' -> ' + command.name.toProperCase())
.setColour(client.functions.displayHexColour(message.channel.guild, client.user.id)) .setColour(client.functions.displayHexColour(message.channel.guild, client.user.id))
.setDescription(command.help.description) .setDescription(command.help.description)
@ -91,6 +90,6 @@ module.exports = class {
return message.channel.createMessage({ embed: embed }); return message.channel.createMessage({ embed: embed });
} }
return message.channel.createMessage(`${client.constants.emojis.userError} ${cmd} doesn't appear to be a command, alias, or category. Are you sure you spelt it right?`); return message.channel.createMessage(`${client.emojis.userError} ${cmd} doesn't appear to be a command, alias, or category. Are you sure you spelt it right?`);
} }
}; };

View file

@ -1,3 +1,5 @@
const replies = require('../../assets/replies.json');
module.exports = class { module.exports = class {
constructor (name, category) { constructor (name, category) {
this.name = name, this.name = name,
@ -17,7 +19,7 @@ module.exports = class {
} }
run (client, message, args, data) { //eslint-disable-line no-unused-vars run (client, message, args, data) { //eslint-disable-line no-unused-vars
message.channel.createMessage(client.constants.replies.ping.random()) message.channel.createMessage(replies.ping.random())
.then(m => { .then(m => {
m.edit(`${m.content} \`roundtrip: ${m.timestamp - message.timestamp}ms | websocket: ${message.channel.guild.shard.latency}ms\``); m.edit(`${m.content} \`roundtrip: ${m.timestamp - message.timestamp}ms | websocket: ${message.channel.guild.shard.latency}ms\``);
}); });

View file

@ -1,5 +1,3 @@
const Embed = require('../../util/embed');
module.exports = class { module.exports = class {
constructor (name, category) { constructor (name, category) {
this.name = name, this.name = name,
@ -28,7 +26,7 @@ module.exports = class {
if (list.length === 0) return message.channel.createMessage('The server blocklist is currently empty. Use `blocklist add <user>` to add people to the blocklist!'); if (list.length === 0) return message.channel.createMessage('The server blocklist is currently empty. Use `blocklist add <user>` to add people to the blocklist!');
const embed = new Embed() const embed = new client.RichEmbed()
.setTitle('Users on blocklist: ' + data.guild.blocklist.length) .setTitle('Users on blocklist: ' + data.guild.blocklist.length)
.setDescription('```' + list.join(', ') + '```') .setDescription('```' + list.join(', ') + '```')
.setColour(client.functions.displayHexColour(message.channel.guild, client.user.id)); .setColour(client.functions.displayHexColour(message.channel.guild, client.user.id));
@ -39,7 +37,7 @@ module.exports = class {
} }
if (!user) return message.channel.createMessage( if (!user) return message.channel.createMessage(
`${client.constants.emojis.userError} You didn't specify a user. Usage: \`${this.help.usage}\`` `${client.emojis.userError} You didn't specify a user. Usage: \`${this.help.usage}\``
); );
let member = message.mentions[0]; let member = message.mentions[0];
@ -47,7 +45,7 @@ module.exports = class {
if (!member) member = await message.channel.guild.searchMembers(user.join(' '), 2); if (!member) member = await message.channel.guild.searchMembers(user.join(' '), 2);
if (member.length > 1) return message.channel.createMessage( if (member.length > 1) return message.channel.createMessage(
`${client.constants.emojis.userError} Found more than one user, try refining your search or pinging the user instead.` `${client.emojis.userError} Found more than one user, try refining your search or pinging the user instead.`
); );
action = action.toLowerCase(); action = action.toLowerCase();
@ -58,24 +56,24 @@ module.exports = class {
if (action === 'add') { if (action === 'add') {
if (member.id === message.channel.guild.ownerID) return message.channel.createMessage( if (member.id === message.channel.guild.ownerID) return message.channel.createMessage(
`${client.constants.emojis.userError} You can't block the owner, silly!` `${client.emojis.userError} You can't block the owner, silly!`
); );
if (client.functions.highestRole(member).position >= client.functions.highestRole(message.member).position && message.member.id !== message.channel.guild.ownerID) { if (client.functions.highestRole(member).position >= client.functions.highestRole(message.member).position && message.member.id !== message.channel.guild.ownerID) {
return message.channel.createMessage(`${client.constants.emojis.userError} This user has a higher role than you, you can't add them to the blocklist!`); return message.channel.createMessage(`${client.emojis.userError} This user has a higher role than you, you can't add them to the blocklist!`);
} }
if (blocklist.includes(member.id)) return message.channel.createMessage( if (blocklist.includes(member.id)) return message.channel.createMessage(
`${client.constants.emojis.userError} This user is already on the blocklist, you can't add them twice!` `${client.emojis.userError} This user is already on the blocklist, you can't add them twice!`
); );
blocklist.push(member.id); blocklist.push(member.id);
client.db.updateGuild(message.channel.guild.id, 'blocklist', blocklist).then(() => { client.db.updateGuild(message.channel.guild.id, 'blocklist', blocklist).then(() => {
message.channel.createMessage(`${client.constants.emojis.success} Added \`${member.username}#${member.discriminator}\` to the blocklist.`); message.channel.createMessage(`${client.emojis.success} Added \`${member.username}#${member.discriminator}\` to the blocklist.`);
}).catch(error => { }).catch(error => {
client.logger.error('GUILD_UPDATE_ERROR', error); client.logger.error('GUILD_UPDATE_ERROR', error);
message.channel.createMessage(`${client.constants.emojis.botError} An error occured while adding this user to the blocklist, please try again! **Error:** ${error}`); message.channel.createMessage(`${client.emojis.botError} An error occured while adding this user to the blocklist, please try again! **Error:** ${error}`);
}) ; }) ;
return; return;
@ -83,20 +81,20 @@ module.exports = class {
if (action === 'remove') { if (action === 'remove') {
if (client.functions.highestRole(member).position >= client.functions.highestRole(message.member).position && message.member.id !== message.channel.guild.ownerID) { if (client.functions.highestRole(member).position >= client.functions.highestRole(message.member).position && message.member.id !== message.channel.guild.ownerID) {
return message.channel.createMessage(`${client.constants.emojis.userError} This user has a higher role than you, you can't remove them to the blocklist!`); return message.channel.createMessage(`${client.emojis.userError} This user has a higher role than you, you can't remove them to the blocklist!`);
} }
if (!blocklist.includes(member.id)) return message.channel.createMessage( if (!blocklist.includes(member.id)) return message.channel.createMessage(
`${client.constants.emojis.userError} This user isn't on the blocklist.` `${client.emojis.userError} This user isn't on the blocklist.`
); );
blocklist.remove(member.id); blocklist.remove(member.id);
client.db.updateGuild(message.channel.guild.id, 'blocklist', blocklist).then(() => { client.db.updateGuild(message.channel.guild.id, 'blocklist', blocklist).then(() => {
message.channel.createMessage(`${client.constants.emojis.success} Removed \`${member.username}#${member.discriminator}\` from the blocklist.`); message.channel.createMessage(`${client.emojis.success} Removed \`${member.username}#${member.discriminator}\` from the blocklist.`);
}).catch(error => { }).catch(error => {
client.logger.error('GUILD_UPDATE_ERROR', error); client.logger.error('GUILD_UPDATE_ERROR', error);
message.channel.createMessage(`${client.constants.emojis.botError} An error occured while removing this user from the blocklist, please try again! **Error:** ${error}`); message.channel.createMessage(`${client.emojis.botError} An error occured while removing this user from the blocklist, please try again! **Error:** ${error}`);
}) ; }) ;
return; return;

View file

@ -27,7 +27,7 @@ module.exports = class {
} }
if (!args[1]) return message.channel.createMessage( if (!args[1]) return message.channel.createMessage(
`${client.constants.emojis.userError} You didn't specify what command/category to disable. Usage: \`${this.help.usage}\`` `${client.emojis.userError} You didn't specify what command/category to disable. Usage: \`${this.help.usage}\``
); );
if (args[0].toLowerCase() === 'command' || args[0].toLowerCase() === 'cmd') { if (args[0].toLowerCase() === 'command' || args[0].toLowerCase() === 'cmd') {
@ -42,17 +42,17 @@ module.exports = class {
} }
if (!command) return message.channel.createMessage( if (!command) return message.channel.createMessage(
`${client.constants.emojis.userError} ${args[1]} isn't a command or an alias, are you sure you spelt it correctly?` `${client.emojis.userError} ${args[1]} isn't a command or an alias, are you sure you spelt it correctly?`
); );
if (essential.commands.includes(command.name) || essential.categories.includes(command.category)) { if (essential.commands.includes(command.name) || essential.categories.includes(command.category)) {
return message.channel.createMessage( return message.channel.createMessage(
`${client.constants.emojis.userError} This command is essential and cannot be disabled. Sorry!` `${client.emojis.userError} This command is essential and cannot be disabled. Sorry!`
); );
} }
if (disabled.includes(command.name)) return message.channel.createMessage( if (disabled.includes(command.name)) return message.channel.createMessage(
`${client.constants.emojis.userError} This command is already disabled.` `${client.emojis.userError} This command is already disabled.`
); );
disabled.push(command.name); disabled.push(command.name);
@ -60,7 +60,7 @@ module.exports = class {
await client.db.updateGuild(message.channel.guild.id, 'disabledcommands', disabled); await client.db.updateGuild(message.channel.guild.id, 'disabledcommands', disabled);
return message.channel.createMessage( return message.channel.createMessage(
`${client.constants.emojis.success} Added **${args[1]}** to the list of disabled commands for this server.` `${client.emojis.success} Added **${args[1]}** to the list of disabled commands for this server.`
); );
} }
@ -76,11 +76,11 @@ module.exports = class {
} }
if (!command) return message.channel.createMessage( if (!command) return message.channel.createMessage(
`${client.constants.emojis.userError} ${args[1]} isn't a category, are you sure you spelt it correctly?` `${client.emojis.userError} ${args[1]} isn't a category, are you sure you spelt it correctly?`
); );
if (!disabled.includes(command.name)) return message.channel.createMessage( if (!disabled.includes(command.name)) return message.channel.createMessage(
`${client.constants.emojis.userError} This category isn't disabled.` `${client.emojis.userError} This category isn't disabled.`
); );
disabled.remove(command.name); disabled.remove(command.name);
@ -88,7 +88,7 @@ module.exports = class {
await client.db.updateGuild(message.channel.guild.id, 'disabledcommands', disabled); await client.db.updateGuild(message.channel.guild.id, 'disabledcommands', disabled);
return message.channel.createMessage( return message.channel.createMessage(
`${client.constants.emojis.success} Added **${args[1]}** to the list of disabled category for this server!` `${client.emojis.success} Added **${args[1]}** to the list of disabled category for this server!`
); );
} }
} }

View file

@ -26,7 +26,7 @@ module.exports = class {
await client.db.updateUser(message.author.id, 'prefix', args[0]); await client.db.updateUser(message.author.id, 'prefix', args[0]);
message.channel.createMessage( message.channel.createMessage(
`${client.constants.emojis.success} Your personal prefix has been set to: \`${args[0]}\`` `${client.emojis.success} Your personal prefix has been set to: \`${args[0]}\``
); );
} }
}; };

View file

@ -1,4 +1,5 @@
const fetch = require('node-fetch'); const fetch = require('node-fetch');
const exitQuotes = require('../../assets/exitQuotes.json');
module.exports = class { module.exports = class {
constructor (name, category) { constructor (name, category) {
@ -19,7 +20,7 @@ module.exports = class {
} }
run (client, message, args, data) { //eslint-disable-line no-unused-vars run (client, message, args, data) { //eslint-disable-line no-unused-vars
client.logger.success('RESTART', 'Restart command recieved. ' + client.constants.exitQuotes.random()); client.logger.success('RESTART', 'Restart command recieved. ' + exitQuotes.random());
client.disconnect(); client.disconnect();
client.functions.wait(); client.functions.wait();

View file

@ -1,5 +1,3 @@
const Embed = require('../../util/embed');
module.exports = class { module.exports = class {
constructor (name, category) { constructor (name, category) {
this.name = name, this.name = name,
@ -38,7 +36,7 @@ module.exports = class {
} }
} }
const embed = new Embed() const embed = new client.RichEmbed()
.setTitle(colour) .setTitle(colour)
.setColour(colour) .setColour(colour)
.setImage(`https://fakeimg.pl/256x256/${colour.replace('#', '')}/?text=%20`); .setImage(`https://fakeimg.pl/256x256/${colour.replace('#', '')}/?text=%20`);

View file

@ -1,5 +1,4 @@
const fetch = require('node-fetch'); const fetch = require('node-fetch');
const Embed = require('../../util/embed');
module.exports = class { module.exports = class {
constructor (name, category) { constructor (name, category) {
@ -26,7 +25,7 @@ module.exports = class {
fetch('https://garfield-comics.glitch.me/~SRoMG/?date=' + date) fetch('https://garfield-comics.glitch.me/~SRoMG/?date=' + date)
.then(res => res.json()) .then(res => res.json())
.then(json => { .then(json => {
const embed = new Embed() const embed = new client.RichEmbed()
.setTitle(`${json.data.name} (No. ${json.data.number})`) .setTitle(`${json.data.name} (No. ${json.data.number})`)
.setColour(client.functions.displayHexColour(message.channel.guild, client.user.id)) .setColour(client.functions.displayHexColour(message.channel.guild, client.user.id))
.setURL('https://www.mezzacotta.net/garfield/?comic=' + json.data.number) .setURL('https://www.mezzacotta.net/garfield/?comic=' + json.data.number)
@ -34,7 +33,7 @@ module.exports = class {
message.channel.createMessage({ embed: embed }); message.channel.createMessage({ embed: embed });
}) })
.catch(err => { .catch(err => {
message.channel.createMessage(`${client.constants.emojis.botError} An error has occurred: ${err}`); message.channel.createMessage(`${client.emojis.botError} An error has occurred: ${err}`);
}); });
} }
}; };

View file

@ -25,7 +25,7 @@ module.exports = class {
.then(res => res.text()) .then(res => res.text())
.then(body => message.channel.createMessage(body)); .then(body => message.channel.createMessage(body));
} catch (err) { } catch (err) {
message.channel.createMessage(`${client.constants.emojis.botError} An error has occurred: ${err}`); message.channel.createMessage(`${client.emojis.botError} An error has occurred: ${err}`);
} }
} }
}; };

View file

@ -1,4 +1,3 @@
const Embed = require('../../util/embed');
const fetch = require('node-fetch'); const fetch = require('node-fetch');
module.exports = class { module.exports = class {
@ -21,7 +20,7 @@ module.exports = class {
run (client, message, args, data) { //eslint-disable-line no-unused-vars run (client, message, args, data) { //eslint-disable-line no-unused-vars
if (!args[0]) return message.channel.createMessage( if (!args[0]) return message.channel.createMessage(
`${client.constants.emojis.userError} You didn't give me an ability to look up!` `${client.emojis.userError} You didn't give me an ability to look up!`
); );
message.channel.sendTyping(); message.channel.sendTyping();
@ -53,7 +52,7 @@ module.exports = class {
json.errors.forEach(error => { json.errors.forEach(error => {
if (error.message.startsWith('Failed to get data for ability')) { if (error.message.startsWith('Failed to get data for ability')) {
message.channel.createMessage( message.channel.createMessage(
`${client.constants.emojis.userError} I couldn't find any abilities with names similar to ${query}. Check your spelling, maybe?` `${client.emojis.userError} I couldn't find any abilities with names similar to ${query}. Check your spelling, maybe?`
); );
} else { } else {
client.logger.error('POKEMON_FETCH_ERROR', error.message); client.logger.error('POKEMON_FETCH_ERROR', error.message);
@ -70,7 +69,7 @@ module.exports = class {
fieldEffects = ` Outside of battle, ${ability.isFieldAbility}`; fieldEffects = ` Outside of battle, ${ability.isFieldAbility}`;
} }
const embed = new Embed() const embed = new client.RichEmbed()
.setColour(client.functions.displayHexColour(message.channel.guild, client.user.id)) .setColour(client.functions.displayHexColour(message.channel.guild, client.user.id))
.setTitle(ability.name.toProperCase()); .setTitle(ability.name.toProperCase());
if (ability.desc) { if (ability.desc) {

View file

@ -1,5 +1,4 @@
const Embed = require('../../util/embed'); const { typeArray, colours } = require('../../assets/pokemon.json');
const { typeArray, colours } = require('../../assets/constants/pokemon.json');
const fetch = require('node-fetch'); const fetch = require('node-fetch');
module.exports = class { module.exports = class {
@ -22,7 +21,7 @@ module.exports = class {
async run (client, message, args, data) { //eslint-disable-line no-unused-vars async run (client, message, args, data) { //eslint-disable-line no-unused-vars
if (!args[0]) return message.channel.createMessage( if (!args[0]) return message.channel.createMessage(
`${client.constants.emojis.userError} You didn't give me a pokemon or type combination to look up! Usage: \`${message.prefix + this.name + ' ' + this.help.arguments}\`` `${client.emojis.userError} You didn't give me a pokemon or type combination to look up! Usage: \`${message.prefix + this.name + ' ' + this.help.arguments}\``
); );
message.channel.sendTyping(); message.channel.sendTyping();
@ -48,7 +47,7 @@ module.exports = class {
json.errors.forEach(error => { json.errors.forEach(error => {
if (error.message.startsWith('No Pokémon found')) { if (error.message.startsWith('No Pokémon found')) {
message.channel.createMessage( message.channel.createMessage(
`${client.constants.emojis.userError} I couldn't find any Pokemon with names similar to ${args.join(' ').toLowerCase()}. Check your spelling, maybe?` `${client.emojis.userError} I couldn't find any Pokemon with names similar to ${args.join(' ').toLowerCase()}. Check your spelling, maybe?`
); );
} else { } else {
client.logger.error('MATCHUP_FETCH_ERROR', error.message); client.logger.error('MATCHUP_FETCH_ERROR', error.message);
@ -82,7 +81,7 @@ module.exports = class {
json.errors.forEach(error => { json.errors.forEach(error => {
if (error.message.includes('does not exist in "Types')) { if (error.message.includes('does not exist in "Types')) {
message.channel.createMessage( message.channel.createMessage(
`${client.constants.emojis.userError} One or more of the types you gave me are invalid. Check your spelling, maybe?` `${client.emojis.userError} One or more of the types you gave me are invalid. Check your spelling, maybe?`
); );
} else { } else {
client.logger.error('MATCHUP_FETCH_ERROR', error.message); client.logger.error('MATCHUP_FETCH_ERROR', error.message);
@ -105,7 +104,7 @@ module.exports = class {
${typeMatchup.defending.effectlessTypes.map(type => `\`${type.toProperCase()}\``).join(' ')} ${typeMatchup.defending.effectlessTypes.map(type => `\`${type.toProperCase()}\``).join(' ')}
`; `;
const embed = new Embed() const embed = new client.RichEmbed()
.setColour(colours[types[0].toProperCase()]) .setColour(colours[types[0].toProperCase()])
.setTitle('Type effectiveness of ' + types.map(type => type.toProperCase()).join(' and ')) .setTitle('Type effectiveness of ' + types.map(type => type.toProperCase()).join(' and '))
.addField('Offensive:', ` .addField('Offensive:', `

View file

@ -1,5 +1,4 @@
const fetch = require('node-fetch'); const fetch = require('node-fetch');
const Embed = require('../../util/embed');
module.exports = class { module.exports = class {
constructor (name, category) { constructor (name, category) {
@ -21,7 +20,7 @@ module.exports = class {
run (client, message, args, data) { //eslint-disable-line no-unused-vars run (client, message, args, data) { //eslint-disable-line no-unused-vars
if (!args[0]) return message.channel.createMessage( if (!args[0]) return message.channel.createMessage(
`${client.constants.emojis.userError} You didn't give me an item to look up!` `${client.emojis.userError} You didn't give me an item to look up!`
); );
message.channel.sendTyping(); message.channel.sendTyping();
@ -54,7 +53,7 @@ module.exports = class {
json.errors.forEach(error => { json.errors.forEach(error => {
if (error.message.startsWith('Failed to get data for item')) { if (error.message.startsWith('Failed to get data for item')) {
message.channel.createMessage( message.channel.createMessage(
`${client.constants.emojis.userError} I couldn't find any items with names similar to ${query}. Check your spelling, maybe?` `${client.emojis.userError} I couldn't find any items with names similar to ${query}. Check your spelling, maybe?`
); );
} else { } else {
client.logger.error('POKEMON_FETCH_ERROR', error.message); client.logger.error('POKEMON_FETCH_ERROR', error.message);
@ -66,7 +65,7 @@ module.exports = class {
const item = json.data.getItemDetailsByFuzzy; const item = json.data.getItemDetailsByFuzzy;
const embed = new Embed() const embed = new client.RichEmbed()
.setColour(client.functions.displayHexColour(message.channel.guild, client.user.id)) .setColour(client.functions.displayHexColour(message.channel.guild, client.user.id))
.setTitle(item.name) .setTitle(item.name)
.setThumbnail(item.sprite) .setThumbnail(item.sprite)

View file

@ -1,6 +1,5 @@
const fetch = require('node-fetch'); const fetch = require('node-fetch');
const Embed = require('../../util/embed'); const { colours } = require('../../assets/pokemon.json');
const { colours } = require('../../assets/constants/pokemon.json');
module.exports = class { module.exports = class {
constructor (name, category) { constructor (name, category) {
@ -22,7 +21,7 @@ module.exports = class {
run (client, message, args, data) { //eslint-disable-line no-unused-vars run (client, message, args, data) { //eslint-disable-line no-unused-vars
if (!args[0]) return message.channel.createMessage( if (!args[0]) return message.channel.createMessage(
`${client.constants.emojis.userError} You didn't give me a pokemon move to look up!` `${client.emojis.userError} You didn't give me a pokemon move to look up!`
); );
message.channel.sendTyping(); message.channel.sendTyping();
@ -66,7 +65,7 @@ module.exports = class {
json.errors.forEach(error => { json.errors.forEach(error => {
if (error.message.startsWith('Failed to get data for move')) { if (error.message.startsWith('Failed to get data for move')) {
message.channel.createMessage( message.channel.createMessage(
`${client.constants.emojis.userError} I couldn't find any moves with names similar to ${query}. Check your spelling, maybe?` `${client.emojis.userError} I couldn't find any moves with names similar to ${query}. Check your spelling, maybe?`
); );
} else { } else {
client.logger.error('POKEMON_FETCH_ERROR', error.message); client.logger.error('POKEMON_FETCH_ERROR', error.message);
@ -91,7 +90,7 @@ module.exports = class {
let fieldEffects = ''; let fieldEffects = '';
if (move.isFieldMove) fieldEffects = ' Outside of battle, ' + move.isFieldMove; if (move.isFieldMove) fieldEffects = ' Outside of battle, ' + move.isFieldMove;
const embed = new Embed() const embed = new client.RichEmbed()
.setColour(colours[move.type]) .setColour(colours[move.type])
.setTitle(move.name.toProperCase() + suffix); .setTitle(move.name.toProperCase() + suffix);
if (move.desc) { if (move.desc) {

View file

@ -1,5 +1,4 @@
const Embed = require('../../util/embed'); const { colours } = require('../../assets/pokemon.json');
const { colours } = require('../../assets/constants/pokemon.json');
const fetch = require('node-fetch'); const fetch = require('node-fetch');
module.exports = class { module.exports = class {
@ -22,7 +21,7 @@ module.exports = class {
async run (client, message, args, data) { //eslint-disable-line no-unused-vars async run (client, message, args, data) { //eslint-disable-line no-unused-vars
if (!args[0]) return message.channel.createMessage( if (!args[0]) return message.channel.createMessage(
`${client.constants.emojis.userError} You didn't give me a pokemon to look up!` `${client.emojis.userError} You didn't give me a pokemon to look up!`
); );
message.channel.sendTyping(); message.channel.sendTyping();
@ -69,7 +68,7 @@ module.exports = class {
json.errors.forEach(error => { json.errors.forEach(error => {
if (error.message.startsWith('No Pokémon found')) { if (error.message.startsWith('No Pokémon found')) {
message.channel.createMessage( message.channel.createMessage(
`${client.constants.emojis.userError} I couldn't find any Pokemon with names similar to ${query}. Check your spelling, maybe?` `${client.emojis.userError} I couldn't find any Pokemon with names similar to ${query}. Check your spelling, maybe?`
); );
} else { } else {
client.logger.error('POKEMON_FETCH_ERROR', error.message); client.logger.error('POKEMON_FETCH_ERROR', error.message);
@ -92,7 +91,7 @@ module.exports = class {
formes = formes.split().concat(pokemon.cosmeticFormes); formes = formes.split().concat(pokemon.cosmeticFormes);
} }
} }
const embed = new Embed() const embed = new client.RichEmbed()
.setColour(colours[pokemon.types[0]]) .setColour(colours[pokemon.types[0]])
.setTitle(`${pokemon.species.toProperCase()} (No. ${pokemon.num})`) .setTitle(`${pokemon.species.toProperCase()} (No. ${pokemon.num})`)
.setDescription(pokemon.flavorTexts[0].flavor) .setDescription(pokemon.flavorTexts[0].flavor)

View file

@ -1,7 +1,7 @@
const fetch = require('node-fetch'); const fetch = require('node-fetch');
const windrose = require('windrose'); const windrose = require('windrose');
const ISO2 = require('../../assets/constants/ISO2.json'); const ISO2 = require('../../assets/ISO2.json');
const Embed = require('../../util/embed');
module.exports = class { module.exports = class {
constructor (name, category) { constructor (name, category) {
@ -57,7 +57,7 @@ module.exports = class {
embedColour = '#ff614f'; embedColour = '#ff614f';
} }
const embed = new Embed() const embed = new client.RichEmbed()
.setTitle(`Weather for ${city + ', ' + ISO2.code[json.sys.country]}`) .setTitle(`Weather for ${city + ', ' + ISO2.code[json.sys.country]}`)
.setThumbnail(`https://openweathermap.org/img/wn/${json.weather[0].icon}@4x.png`) .setThumbnail(`https://openweathermap.org/img/wn/${json.weather[0].icon}@4x.png`)
.setColour(embedColour) .setColour(embedColour)
@ -74,13 +74,13 @@ module.exports = class {
return message.channel.createMessage({ embed:embed }); return message.channel.createMessage({ embed:embed });
} else { } else {
if (json.message && json.message === 'city not found') { if (json.message && json.message === 'city not found') {
return message.channel.createMessage(`${client.constants.emojis.userError} You provided an invalid city name. Maybe check your spelling?`); return message.channel.createMessage(`${client.emojis.userError} You provided an invalid city name. Maybe check your spelling?`);
} }
return message.channel.createMessage(`${client.constants.emojis.botError} API error occured: \`code ${json.cod}: ${json.message}\``); return message.channel.createMessage(`${client.emojis.botError} API error occured: \`code ${json.cod}: ${json.message}\``);
} }
}) })
.catch(err => { .catch(err => {
return message.channel.createMessage(`${client.constants.emojis.botError} An error has occured: \`${err.stack}\``); return message.channel.createMessage(`${client.emojis.botError} An error has occured: \`${err.stack}\``);
}); });
} }
}; };

View file

@ -1,10 +1,12 @@
const activities = require('../../assets/activities.json');
module.exports = class { module.exports = class {
constructor (wsEvent) { constructor (wsEvent) {
this.wsEvent = wsEvent; this.wsEvent = wsEvent;
} }
async run (client) { async run (client) {
const activity = client.constants.activities.random(); const activity = activities.random();
client.editStatus('online', { name: `${activity.message} | v${client.version}`, type: activity.type}); client.editStatus('online', { name: `${activity.message} | v${client.version}`, type: activity.type});
} }
}; };

View file

@ -1,4 +1,4 @@
const colours = require('../assets/constants/colours.json'); const colours = require('../assets/colours.json');
const HEX_REGEX = /#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/; const HEX_REGEX = /#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
class RichEmbed { class RichEmbed {

View file

@ -1,5 +1,6 @@
// const { MessageCollector } = require('eris-collector'); // const { MessageCollector } = require('eris-collector');
const { inspect, promisify } = require('util'); const { inspect, promisify } = require('util');
const colours = require('../assets/colours.json');
class Functions { class Functions {
constructor (client) { constructor (client) {
@ -44,8 +45,8 @@ class Functions {
if (object.color !== 0) return '#' + object.color.toString(16); if (object.color !== 0) return '#' + object.color.toString(16);
} }
const colours = Object.keys(this.client.constants.colours); const colourKeys = Object.keys(colours);
return this.client.constants.colours[colours[ colours.length * Math.random() << 0]]; return colours[colourKeys[ colours.length * Math.random() << 0]];
} }
highestRole (member) { highestRole (member) {

View file

@ -62,33 +62,33 @@ class MessageHandler {
// Both of these blocks check if the command is disabled/in a disabled category // Both of these blocks check if the command is disabled/in a disabled category
if (data.guild.disabledcommands.includes(command.name)) return message.channel.createMessage( if (data.guild.disabledcommands.includes(command.name)) return message.channel.createMessage(
this.client.constants.emojis.permError + ' This command has been disabled by a server administrator.' this.client.emojis.permError + ' This command has been disabled by a server administrator.'
); );
if (data.guild.disabledcategories.includes(command.category)) return message.channel.createMessage( if (data.guild.disabledcategories.includes(command.category)) return message.channel.createMessage(
this.client.constants.emojis.permError + ' The category this command is apart of has been disabled by a server administrator.' this.client.emojis.permError + ' The category this command is apart of has been disabled by a server administrator.'
); );
// Both of these blocks check the permissions of the user, and reply with missing perms if any are found // Both of these blocks check the permissions of the user, and reply with missing perms if any are found
const missingUserPerms = this.client.functions.checkPermissions(message.channel, message.author.id, command.userPerms); const missingUserPerms = this.client.functions.checkPermissions(message.channel, message.author.id, command.userPerms);
if (missingUserPerms) return message.channel.createMessage( if (missingUserPerms) return message.channel.createMessage(
`${this.client.constants.emojis.permError} You can't use this command because you lack these permissions: \`${missingUserPerms.join('`, `')}\`` `${this.client.emojis.permError} You can't use this command because you lack these permissions: \`${missingUserPerms.join('`, `')}\``
); );
const missingBotPerms = this.client.functions.checkPermissions(message.channel, this.client.user.id, command.botPerms); const missingBotPerms = this.client.functions.checkPermissions(message.channel, this.client.user.id, command.botPerms);
if (missingBotPerms) return message.channel.createMessage( if (missingBotPerms) return message.channel.createMessage(
`${this.client.constants.emojis.permError} I can't run this command because I lack these permissions: \`${missingBotPerms.join('`, `')}\`` `${this.client.emojis.permError} I can't run this command because I lack these permissions: \`${missingBotPerms.join('`, `')}\``
); );
// Return if the command is disabled globally // Return if the command is disabled globally
if (command.enabled === false) return message.channel.createMessage( if (command.enabled === false) return message.channel.createMessage(
this.client.constants.emojis.permError + ' This command has been disabled by my developers.' this.client.emojis.permError + ' This command has been disabled by my developers.'
); );
// Return if the command is restricted to developers (and the user is not a developer) // Return if the command is restricted to developers (and the user is not a developer)
if (command.devOnly === true && this.client.config.ownerIDs.includes(message.author.id) !== true) { if (command.devOnly === true && this.client.config.ownerIDs.includes(message.author.id) !== true) {
return message.channel.createMessage( return message.channel.createMessage(
`${this.client.constants.emojis.permError} ${message.author.username} is not in the sudoers file. This incident will be reported.` `${this.client.emojis.permError} ${message.author.username} is not in the sudoers file. This incident will be reported.`
); );
} }
@ -99,7 +99,7 @@ class MessageHandler {
const cooldown = command.cooldown / 1000; const cooldown = command.cooldown / 1000;
const timePassed = Math.floor((currentTime - timestamp) / 1000); const timePassed = Math.floor((currentTime - timestamp) / 1000);
return message.channel.createMessage( return message.channel.createMessage(
`${this.client.constants.emojis.wait} ${message.author.mention}, you need to wait ${cooldown - timePassed} seconds before using this command again.` `${this.client.emojis.wait} ${message.author.mention}, you need to wait ${cooldown - timePassed} seconds before using this command again.`
); );
} else { } else {
this.client.cooldowns.get(command.name).set(message.author.id, new Date()); this.client.cooldowns.get(command.name).set(message.author.id, new Date());