changes for eris + new loading UX

This commit is contained in:
Emily 2021-07-17 15:55:18 +10:00
parent 9231fcc671
commit 022ec6b999
18 changed files with 84 additions and 81 deletions

View file

@ -30,9 +30,9 @@ module.exports = class {
}); });
if (!args[0]) { if (!args[0]) {
const embed = new client.RichEmbed(); const embed = new client.MessageEmbed();
embed.setTitle('Help & Commands'); embed.setTitle('Help & Commands');
embed.setColour(client.functions.displayHexColour(message.guild)); embed.setColor(client.functions.embedColor(message.guild));
embed.setDescription( embed.setDescription(
` `
» Use \`${message.prefix}help [category]\` to get basic information on all commands in the category. » Use \`${message.prefix}help [category]\` to get basic information on all commands in the category.
@ -48,7 +48,7 @@ module.exports = class {
}); });
embed.setFooter('<> = required, / = either/or, [] = optional'); embed.setFooter('<> = required, / = either/or, [] = optional');
return message.channel.send({ embed: embed }); return message.channel.send({ embeds: [embed] });
} }
const cat = args[0].toProperCase(); const cat = args[0].toProperCase();
@ -64,20 +64,20 @@ 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 client.RichEmbed() const embed = new client.MessageEmbed()
.setTitle(prettified[cat].emoji + ' ' + cat) .setTitle(prettified[cat].emoji + ' ' + cat)
.setColour(client.functions.displayHexColour(message.guild)) .setColor(client.functions.embedColor(message.guild))
.setDescription(cmds) .setDescription(cmds)
.setFooter('<> = required, / = either/or, [] = optional'); .setFooter('<> = required, / = either/or, [] = optional');
return message.channel.send({ embed: embed }); return message.channel.send({ embeds: [embed] });
} }
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 client.RichEmbed() const embed = new client.MessageEmbed()
.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.guild)) .setColor(client.functions.embedColor(message.guild))
.setDescription(command.help.description) .setDescription(command.help.description)
.addField('Format:', `\`${message.prefix + command.name} ${command.help.arguments}`.trim() + '`'); .addField('Format:', `\`${message.prefix + command.name} ${command.help.arguments}`.trim() + '`');
if (command.help.details.length > 0) embed.addField('Parameters:', command.help.details); if (command.help.details.length > 0) embed.addField('Parameters:', command.help.details);
@ -87,7 +87,7 @@ module.exports = class {
if (command.botPerms.length > 0) embed.addField('Bot permissions:', command.botPerms.join(', '), true); if (command.botPerms.length > 0) embed.addField('Bot permissions:', command.botPerms.join(', '), true);
embed.addField('Cooldown:', `${command.cooldown / 1000} seconds`, true); embed.addField('Cooldown:', `${command.cooldown / 1000} seconds`, true);
embed.setFooter('<> = required, / = either/or, [] = optional'); embed.setFooter('<> = required, / = either/or, [] = optional');
return message.channel.send({ embed: embed }); return message.channel.send({ embeds: [embed] });
} }
return message.channel.send(`${client.config.emojis.userError} ${cmd} doesn't appear to be a command, alias, or category. Are you sure you spelt it right?`); return message.channel.send(`${client.config.emojis.userError} ${cmd} doesn't appear to be a command, alias, or category. Are you sure you spelt it right?`);

View file

@ -20,18 +20,18 @@ module.exports = class {
if (!action || action.toLowerCase() === 'list') { if (!action || action.toLowerCase() === 'list') {
const list = []; const list = [];
for (const userID of data.guild.blocklist) { for (const userID of data.guild.blocklist) {
const user = await client.functions.getUser(userID); const user = await client.users.fetch(userID);
list.push(`${user.username}#${user.discriminator}`); list.push(`${user.username}#${user.discriminator}`);
} }
if (list.length === 0) return message.channel.send('The server blocklist is currently empty. Use `blocklist add <user>` to add people to the blocklist!'); if (list.length === 0) return message.channel.send('The server blocklist is currently empty. Use `blocklist add <user>` to add people to the blocklist!');
const embed = new client.RichEmbed() const embed = new client.MessageEmbed()
.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.guild)); .setColor(client.functions.embedColor(message.guild));
message.channel.send({ embed: embed }); message.channel.send({ embeds: [embed] });
return; return;
} }
@ -49,7 +49,7 @@ module.exports = class {
let member; let member;
if (message.mentions.length > 0) { if (message.mentions.length > 0) {
member = await client.functions.getMember(message.guild, message.mentions[0].id); member = await message.guild.members.fetch(message.mentions[0].id);
} else { } else {
member = await client.functions.validateUserID(message.guild, user[0]); member = await client.functions.validateUserID(message.guild, user[0]);

View file

@ -36,11 +36,11 @@ module.exports = class {
} }
} }
const embed = new client.RichEmbed() const embed = new client.MessageEmbed()
.setTitle(colour) .setTitle(colour)
.setColour(colour) .setColor(colour)
.setImage(`https://fakeimg.pl/256x256/${colour.replace('#', '')}/?text=%20`); .setImage(`https://fakeimg.pl/256x256/${colour.replace('#', '')}/?text=%20`);
message.channel.send({ embed: embed }); message.channel.send({ embeds: [embed] });
} }
}; };

View file

@ -18,22 +18,22 @@ module.exports = class {
}; };
} }
run (client, message, args, data) { //eslint-disable-line no-unused-vars async run (client, message, args, data) { //eslint-disable-line no-unused-vars
let date = 'xxxx'; let date = 'xxxx';
if (args[0] && args[0].toLowerCase() === 'daily') date = new Date(); if (args[0] && args[0].toLowerCase() === 'daily') date = new Date();
message.channel.sendTyping(); const editMessage = await message.channel.send(`${client.config.emojis.loading} Please wait...`);
fetch('https://garfield-comics.glitch.me/~SRoMG/?date=' + date, { headers: { 'User-Agent': client.config.userAgent }}) fetch('`https://garfield-comics.glitch.me/`~SRoMG/?date=' + date, { headers: { 'User-Agent': client.config.userAgent }})
.then(res => res.json()) .then(res => res.json())
.then(json => { .then(json => {
const embed = new client.RichEmbed() const embed = new client.MessageEmbed()
.setTitle(`${json.data.name} (No. ${json.data.number})`) .setTitle(`${json.data.name} (No. ${json.data.number})`)
.setColour(client.functions.displayHexColour(message.guild)) .setColor(client.functions.embedColor(message.guild))
.setURL('https://www.mezzacotta.net/garfield/?comic=' + json.data.number) .setURL('https://www.mezzacotta.net/garfield/?comic=' + json.data.number)
.setImage(json.data.image.src); .setImage(json.data.image.src);
message.channel.send({ embed: embed }); editMessage.edit({ embeds: [embed] });
}) })
.catch(err => { .catch(err => {
message.channel.send(`${client.config.emojis.botError} An error has occurred: ${err}`); editMessage.edit(`${client.config.emojis.botError} An error has occurred: ${err}`);
}); });
} }
}; };

View file

@ -18,14 +18,14 @@ module.exports = class {
}; };
} }
run (client, message, args, data) { //eslint-disable-line no-unused-vars async run (client, message, args, data) { //eslint-disable-line no-unused-vars
message.channel.sendTyping(); const editMessage = await message.channel.send(`${client.config.emojis.loading} Please wait...`);
try { try {
fetch('http://inspirobot.me/api?generate=true', { headers: { 'User-Agent': client.config.userAgent }}) fetch('http://inspirobot.me/api?generate=true', { headers: { 'User-Agent': client.config.userAgent }})
.then(res => res.text()) .then(res => res.text())
.then(body => message.channel.send(body)); .then(body => editMessage.edit(body));
} catch (err) { } catch (err) {
message.channel.send(`${client.config.emojis.botError} An error has occurred: ${err}`); editMessage.edit(`${client.config.emojis.botError} An error has occurred: ${err}`);
} }
} }
}; };

View file

@ -18,12 +18,12 @@ module.exports = class {
}; };
} }
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.send( if (!args[0]) return message.channel.send(
`${client.config.emojis.userError} You didn't give me an ability to look up!` `${client.config.emojis.userError} You didn't give me an ability to look up!`
); );
message.channel.sendTyping(); const editMessage = await message.channel.send(`${client.config.emojis.loading} Please wait...`);
const query = args.join(' ').toLowerCase(); const query = args.join(' ').toLowerCase();
@ -52,7 +52,7 @@ module.exports = class {
if (json.errors) { if (json.errors) {
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.send( editMessage.edit(
`${client.config.emojis.userError} I couldn't find any abilities with names similar to ${query}. Check your spelling, maybe?` `${client.config.emojis.userError} I couldn't find any abilities with names similar to ${query}. Check your spelling, maybe?`
); );
} else { } else {
@ -70,8 +70,8 @@ module.exports = class {
fieldEffects = ` Outside of battle, ${ability.isFieldAbility}`; fieldEffects = ` Outside of battle, ${ability.isFieldAbility}`;
} }
const embed = new client.RichEmbed() const embed = new client.MessageEmbed()
.setColour(client.functions.displayHexColour(message.guild)) .setColor(client.functions.embedColor(message.guild))
.setTitle(ability.name.toProperCase()); .setTitle(ability.name.toProperCase());
if (ability.desc) { if (ability.desc) {
embed.setDescription(ability.desc + fieldEffects); embed.setDescription(ability.desc + fieldEffects);
@ -79,7 +79,7 @@ module.exports = class {
embed.setDescription(ability.shortDesc + fieldEffects); embed.setDescription(ability.shortDesc + fieldEffects);
} }
embed.addField('External Resources:', `[Bulbapedia](${ability.bulbapediaPage}) • [Serebii](${ability.serebiiPage}) • [Smogon](${ability.smogonPage})`); embed.addField('External Resources:', `[Bulbapedia](${ability.bulbapediaPage}) • [Serebii](${ability.serebiiPage}) • [Smogon](${ability.smogonPage})`);
message.channel.send({ embed: embed }); editMessage.edit({ content: null, embeds: [embed] });
}); });
} }
}; };

View file

@ -24,7 +24,7 @@ module.exports = class {
`${client.config.emojis.userError} You didn't give me a pokemon or type combination to look up! Usage: \`${message.prefix + this.name + ' ' + this.help.arguments}\`` `${client.config.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(); const editMessage = await message.channel.send(`${client.config.emojis.loading} Please wait...`);
let types; let types;
@ -105,8 +105,8 @@ module.exports = class {
${typeMatchup.defending.effectlessTypes.map(type => `\`${type.toProperCase()}\``).join(' ')} ${typeMatchup.defending.effectlessTypes.map(type => `\`${type.toProperCase()}\``).join(' ')}
`; `;
const embed = new client.RichEmbed() const embed = new client.MessageEmbed()
.setColour(colours[types[0].toProperCase()]) .setColor(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:', `
**Super-effective:** **Super-effective:**
@ -120,7 +120,7 @@ module.exports = class {
**Resistances:** **Resistances:**
${this.parseResistedTypes(typeMatchup.defending.resistedTypes, typeMatchup.defending.doubleResistedTypes)}${immune} ${this.parseResistedTypes(typeMatchup.defending.resistedTypes, typeMatchup.defending.doubleResistedTypes)}${immune}
`); `);
message.channel.send({ embed: embed }); editMessage.edit({ content: null, embeds: [embed] });
}); });
} }

View file

@ -18,12 +18,12 @@ module.exports = class {
}; };
} }
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.send( if (!args[0]) return message.channel.send(
`${client.config.emojis.userError} You didn't give me an item to look up!` `${client.config.emojis.userError} You didn't give me an item to look up!`
); );
message.channel.sendTyping(); const editMessage = await message.channel.send(`${client.config.emojis.loading} Please wait...`);
const query = args.join(' ').toLowerCase(); const query = args.join(' ').toLowerCase();
@ -66,8 +66,8 @@ module.exports = class {
const item = json.data.getItemDetailsByFuzzy; const item = json.data.getItemDetailsByFuzzy;
const embed = new client.RichEmbed() const embed = new client.MessageEmbed()
.setColour(client.functions.displayHexColour(message.guild)) .setColor(client.functions.embedColor(message.guild))
.setTitle(item.name) .setTitle(item.name)
.setThumbnail(item.sprite) .setThumbnail(item.sprite)
.addField('External Resources:', `[Bulbapedia](${item.bulbapediaPage}) • [Serebii](${item.serebiiPage}) • [Smogon](${item.smogonPage})`); .addField('External Resources:', `[Bulbapedia](${item.bulbapediaPage}) • [Serebii](${item.serebiiPage}) • [Smogon](${item.smogonPage})`);
@ -76,7 +76,7 @@ module.exports = class {
} else { } else {
embed.setDescription(`${item.shortDesc} Added in Generation ${item.generationIntroduced}.`); embed.setDescription(`${item.shortDesc} Added in Generation ${item.generationIntroduced}.`);
} }
message.channel.send({ embed: embed }); editMessage.edit({ content: null, embeds: [embed] });
}); });
} }
}; };

View file

@ -19,12 +19,12 @@ module.exports = class {
}; };
} }
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.send( if (!args[0]) return message.channel.send(
`${client.config.emojis.userError} You didn't give me a pokemon move to look up!` `${client.config.emojis.userError} You didn't give me a pokemon move to look up!`
); );
message.channel.sendTyping(); const editMessage = await message.channel.send(`${client.config.emojis.loading} Please wait...`);
const query = args.join(' ').toLowerCase(); const query = args.join(' ').toLowerCase();
@ -91,8 +91,8 @@ 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 client.RichEmbed() const embed = new client.MessageEmbed()
.setColour(colours[move.type]) .setColor(colours[move.type])
.setTitle(move.name.toProperCase() + suffix); .setTitle(move.name.toProperCase() + suffix);
if (move.desc) { if (move.desc) {
embed.setDescription(move.desc + fieldEffects); embed.setDescription(move.desc + fieldEffects);
@ -113,7 +113,7 @@ module.exports = class {
if (move.isGMax) embed.addField('G-Max Pokemon:', move.isGMax, true); if (move.isGMax) embed.addField('G-Max Pokemon:', move.isGMax, true);
if (move.contestType !== null) embed.addField('Contest Type', move.contestType, true); if (move.contestType !== null) embed.addField('Contest Type', move.contestType, true);
embed.addField('External Resources:', `[Bulbapedia](${move.bulbapediaPage}) • [Serebii](${move.serebiiPage}) • [Smogon](${move.smogonPage})`); embed.addField('External Resources:', `[Bulbapedia](${move.bulbapediaPage}) • [Serebii](${move.serebiiPage}) • [Smogon](${move.smogonPage})`);
message.channel.send({ embed: embed }); editMessage.edit({ content: null, embeds: [embed] });
}); });
} }
}; };

View file

@ -24,7 +24,7 @@ module.exports = class {
`${client.config.emojis.userError} You didn't give me a pokemon to look up!` `${client.config.emojis.userError} You didn't give me a pokemon to look up!`
); );
message.channel.sendTyping(); const editMessage = await message.channel.send(`${client.config.emojis.loading} Please wait...`);
const query = args.join(' ').toLowerCase(); const query = args.join(' ').toLowerCase();
@ -92,8 +92,8 @@ module.exports = class {
formes = formes.split().concat(pokemon.cosmeticFormes); formes = formes.split().concat(pokemon.cosmeticFormes);
} }
} }
const embed = new client.RichEmbed() const embed = new client.MessageEmbed()
.setColour(colours[pokemon.types[0]]) .setColor(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)
.setThumbnail(sprite) .setThumbnail(sprite)
@ -108,7 +108,7 @@ module.exports = class {
embed.addField('Egg Groups:', pokemon.eggGroups.join(', '), true); embed.addField('Egg Groups:', pokemon.eggGroups.join(', '), true);
embed.addField('Smogon Tier:', pokemon.smogonTier, true); embed.addField('Smogon Tier:', pokemon.smogonTier, true);
embed.addField('External Resources:', `[Bulbapedia](${pokemon.bulbapediaPage}) • [Serebii](${pokemon.serebiiPage}) • [Smogon](${pokemon.smogonPage})`); embed.addField('External Resources:', `[Bulbapedia](${pokemon.bulbapediaPage}) • [Serebii](${pokemon.serebiiPage}) • [Smogon](${pokemon.smogonPage})`);
message.channel.send({ embed: embed }); editMessage.edit({ content: null, embeds: [embed] });
}); });
} }

View file

@ -33,18 +33,18 @@ module.exports = class {
if ((json.details[0].start_time * 1000) > Date.now() === true) { if ((json.details[0].start_time * 1000) > Date.now() === true) {
embeds.push( embeds.push(
new client.RichEmbed() new client.MessageEmbed()
.setTitle('Upcoming Salmon Run') .setTitle('Upcoming Salmon Run')
.setColour(client.functions.displayHexColour(message.guild)) .setColor(client.functions.embedColor(message.guild))
.setImage('https://splatoon2.ink/assets/splatnet/'+json.details[0].stage.image) .setImage('https://splatoon2.ink/assets/splatnet/'+json.details[0].stage.image)
.addField('Map', json.details[0].stage.name, true) .addField('Map', json.details[0].stage.name, true)
.setFooter(`Starting in ${prettifyMiliseconds(json.details[0].start_time * 1000 - Date.now(), { secondsDecimalDigits: 0 })} | Data provided by splatoon2.ink`) .setFooter(`Starting in ${prettifyMiliseconds(json.details[0].start_time * 1000 - Date.now(), { secondsDecimalDigits: 0 })} | Data provided by splatoon2.ink`)
); );
} else { } else {
embeds.push( embeds.push(
new client.RichEmbed() new client.MessageEmbed()
.setTitle('Current Salmon Run') .setTitle('Current Salmon Run')
.setColour(client.functions.displayHexColour(message.guild)) .setColor(client.functions.embedColor(message.guild))
.setThumbnail('https://splatoon2.ink/assets/splatnet'+timelineJson.coop.reward_gear.gear.image) .setThumbnail('https://splatoon2.ink/assets/splatnet'+timelineJson.coop.reward_gear.gear.image)
.setImage('https://splatoon2.ink/assets/splatnet/'+json.details[0].stage.image) .setImage('https://splatoon2.ink/assets/splatnet/'+json.details[0].stage.image)
.addField('Map', json.details[0].stage.name, true) .addField('Map', json.details[0].stage.name, true)
@ -55,9 +55,9 @@ module.exports = class {
} }
embeds.push( embeds.push(
new client.RichEmbed() new client.MessageEmbed()
.setTitle('Upcoming Salmon Run') .setTitle('Upcoming Salmon Run')
.setColour(client.functions.displayHexColour(message.guild)) .setColor(client.functions.embedColor(message.guild))
.setImage('https://splatoon2.ink/assets/splatnet/'+json.details[1].stage.image) .setImage('https://splatoon2.ink/assets/splatnet/'+json.details[1].stage.image)
.addField('Map', json.details[1].stage.name, true) .addField('Map', json.details[1].stage.name, true)
.addField('Weapons', json.details[1].weapons[1].weapon.name+', '+json.details[1].weapons[1].weapon.name+', '+json.details[1].weapons[2].weapon.name+', '+json.details[1].weapons[3].weapon.name) .addField('Weapons', json.details[1].weapons[1].weapon.name+', '+json.details[1].weapons[1].weapon.name+', '+json.details[1].weapons[2].weapon.name+', '+json.details[1].weapons[3].weapon.name)

View file

@ -28,10 +28,10 @@ module.exports = class {
const embeds = []; const embeds = [];
for ( let i = 0; i < json.merchandises.length; i++ ) { for ( let i = 0; i < json.merchandises.length; i++ ) {
const embed = new client.RichEmbed() const embed = new client.MessageEmbed()
.setTitle(json.merchandises[i].gear.name) .setTitle(json.merchandises[i].gear.name)
.setThumbnail('https://splatoon2.ink/assets/splatnet' + json.merchandises[i].gear.image) .setThumbnail('https://splatoon2.ink/assets/splatnet' + json.merchandises[i].gear.image)
.setColour(client.functions.displayHexColour(message.guild)) .setColor(client.functions.embedColor(message.guild))
.addField('Price', (json.merchandises[i].price).toString(), true) .addField('Price', (json.merchandises[i].price).toString(), true)
.addField('Brand', json.merchandises[i].gear.brand.name, true) .addField('Brand', json.merchandises[i].gear.brand.name, true)
.addField('Ability Slots', (json.merchandises[i].gear.rarity + 1).toString(), true) .addField('Ability Slots', (json.merchandises[i].gear.rarity + 1).toString(), true)

View file

@ -27,9 +27,9 @@ module.exports = class {
.then(json => { .then(json => {
const embeds = [ const embeds = [
new client.RichEmbed() new client.MessageEmbed()
.setTitle('Current Splatoon 2 Maps') .setTitle('Current Splatoon 2 Maps')
.setColour(client.functions.displayHexColour(message.guild)) .setColor(client.functions.embedColor(message.guild))
.addField('<:turf_war:814651383911153692> Turf War', `${json.regular[0].stage_a.name}\n${json.regular[0].stage_b.name}`, true) .addField('<:turf_war:814651383911153692> Turf War', `${json.regular[0].stage_a.name}\n${json.regular[0].stage_b.name}`, true)
.addField(`<:ranked:814651402479468544> Ranked: ${json.gachi[0].rule.name}`, `${json.gachi[0].stage_a.name}\n${json.gachi[0].stage_b.name}`, true) .addField(`<:ranked:814651402479468544> Ranked: ${json.gachi[0].rule.name}`, `${json.gachi[0].stage_a.name}\n${json.gachi[0].stage_b.name}`, true)
.addField(`<:league:814651415409590363> League: ${json.league[0].rule.name}`, `${json.league[0].stage_a.name}\n${json.league[0].stage_b.name}`, true) .addField(`<:league:814651415409590363> League: ${json.league[0].rule.name}`, `${json.league[0].stage_a.name}\n${json.league[0].stage_b.name}`, true)
@ -37,9 +37,9 @@ module.exports = class {
]; ];
for ( let i = 1; i < json.regular.length; i++ ) { for ( let i = 1; i < json.regular.length; i++ ) {
const embed = new client.RichEmbed() const embed = new client.MessageEmbed()
.setTitle('Upcoming Splatoon 2 Maps') .setTitle('Upcoming Splatoon 2 Maps')
.setColour(client.functions.displayHexColour(message.guild)) .setColor(client.functions.embedColor(message.guild))
.addField('<:turf_war:814651383911153692> Turf War', `${json.regular[i].stage_a.name}\n${json.regular[i].stage_b.name}`, true) .addField('<:turf_war:814651383911153692> Turf War', `${json.regular[i].stage_a.name}\n${json.regular[i].stage_b.name}`, true)
.addField(`<:ranked:814651402479468544> Ranked: ${json.gachi[i].rule.name}`, `${json.gachi[i].stage_a.name}\n${json.gachi[i].stage_b.name}`, true) .addField(`<:ranked:814651402479468544> Ranked: ${json.gachi[i].rule.name}`, `${json.gachi[i].stage_a.name}\n${json.gachi[i].stage_b.name}`, true)
.addField(`<:league:814651415409590363> League: ${json.league[i].rule.name}`, `${json.league[i].stage_a.name}\n${json.league[i].stage_b.name}`, true) .addField(`<:league:814651415409590363> League: ${json.league[i].rule.name}`, `${json.league[i].stage_a.name}\n${json.league[i].stage_b.name}`, true)

View file

@ -22,7 +22,7 @@ module.exports = class {
if (args[0]) { if (args[0]) {
if (message.mentions.length > 0) { if (message.mentions.length > 0) {
member = await client.functions.getMember(message.guild, message.mentions[0].id); member = await message.guild.members.fetch(message.mentions[0].id)
} else { } else {
member = await client.functions.validateUserID(message.guild, args[0]); member = await client.functions.validateUserID(message.guild, args[0]);
@ -42,11 +42,11 @@ module.exports = class {
} }
} }
const embed = new client.RichEmbed() const embed = new client.MessageEmbed()
.setTitle(member.user.username + '#' + member.user.discriminator) .setTitle(member.user.username + '#' + member.user.discriminator)
.setColour(client.functions.displayHexColour(message.guild, member)) .setColor(client.functions.embedColor(message.guild, member))
.setImage(member.user.avatarURL); .setImage(member.user.avatarURL);
message.channel.send({ embed: embed }); message.channel.send({ embeds: [embed] });
} }
}; };

View file

@ -19,8 +19,8 @@ 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
const guild = message.guild; const guild = message.guild;
const embed = new client.RichEmbed() const embed = new client.MessageEmbed()
.setColour(client.functions.displayHexColour(message.guild)) .setColor(client.functions.embedColor(message.guild))
.setTitle(guild.name) .setTitle(guild.name)
.setThumbnail(guild.iconURL) .setThumbnail(guild.iconURL)
.addField('ID', guild.id, true) .addField('ID', guild.id, true)
@ -29,6 +29,6 @@ module.exports = class {
.addField('Boosts', `${guild.premiumSubscriptionCount} (Level ${guild.premiumTier})`, true) .addField('Boosts', `${guild.premiumSubscriptionCount} (Level ${guild.premiumTier})`, true)
.addField('Member Count (Approximate)', `${guild.memberCount} (${guild.memberCount - guild.members.filter(member => member.user.bot).length} humans, ${guild.members.filter(member => member.user.bot).length} bots)`, true) .addField('Member Count (Approximate)', `${guild.memberCount} (${guild.memberCount - guild.members.filter(member => member.user.bot).length} humans, ${guild.members.filter(member => member.user.bot).length} bots)`, true)
.addField('Channels', `${guild.channels.size} ()`) .addField('Channels', `${guild.channels.size} ()`)
message.channel.send({ embed: embed }); message.channel.send({ embeds: [embed] });
} }
}; };

View file

@ -24,7 +24,7 @@ module.exports = class {
if (args[0]) { if (args[0]) {
if (message.mentions.length > 0) { if (message.mentions.length > 0) {
member = await client.functions.getMember(message.guild, message.mentions[0].id); member = await message.guild.members.fetch(message.mentions[0].id)
} else { } else {
member = await client.functions.validateUserID(message.guild, args[0]); member = await client.functions.validateUserID(message.guild, args[0]);
@ -61,9 +61,9 @@ module.exports = class {
roles.push(`<@&${roleID}>`); roles.push(`<@&${roleID}>`);
} }
const embed = new client.RichEmbed() const embed = new client.MessageEmbed()
.setTitle(member.user.username + '#' + member.user.discriminator) .setTitle(member.user.username + '#' + member.user.discriminator)
.setColour(client.functions.displayHexColour(message.guild, member)) .setColor(client.functions.embedColor(message.guild, member))
.setThumbnail(member.user.avatarURL || member.user.defaultAvatarURL) .setThumbnail(member.user.avatarURL || member.user.defaultAvatarURL)
.addField('Display Name', member.nick || member.user.username, true) .addField('Display Name', member.nick || member.user.username, true)
.addField('User ID', member.id, true) .addField('User ID', member.id, true)
@ -73,6 +73,6 @@ module.exports = class {
.addField('Joined Discord', `${dayjs(member.user.createdAt).format('D/M/YYYY HH:mm (UTCZ)')}\n*${dayjs().to(member.user.createdAt)}*`, true); .addField('Joined Discord', `${dayjs(member.user.createdAt).format('D/M/YYYY HH:mm (UTCZ)')}\n*${dayjs().to(member.user.createdAt)}*`, true);
if (badges.length > 0) embed.setDescription(badges.join(' ')); if (badges.length > 0) embed.setDescription(badges.join(' '));
message.channel.send({ embed: embed }); message.channel.send({ embeds: [embed] });
} }
}; };

View file

@ -21,7 +21,7 @@ module.exports = class {
}; };
} }
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; if (!args[0]) return;
let city = args.join(' ').toProperCase(); let city = args.join(' ').toProperCase();
@ -35,10 +35,9 @@ module.exports = class {
} else { } else {
countryCode += params[1].trim(); countryCode += params[1].trim();
} }
console.log(countryCode);
} }
message.channel.sendTyping(); const editMessage = await message.channel.send(`${client.config.emojis.loading} Please wait...`);
fetch(`https://api.openweathermap.org/data/2.5/weather?q=${city + countryCode}&appid=${client.config.keys.weather}`, { headers: { 'User-Agent': client.config.userAgent }}) fetch(`https://api.openweathermap.org/data/2.5/weather?q=${city + countryCode}&appid=${client.config.keys.weather}`, { headers: { 'User-Agent': client.config.userAgent }})
.then(res => res.json()) .then(res => res.json())
.then(json => { .then(json => {
@ -57,10 +56,10 @@ module.exports = class {
embedColour = '#ff614f'; embedColour = '#ff614f';
} }
const embed = new client.RichEmbed() const embed = new client.MessageEmbed()
.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) .setColor(embedColour)
.addField('Condition:', json.weather[0].main, true) .addField('Condition:', json.weather[0].main, true)
.addField('Temperature:', `${tempCelcius}°C | ${Math.round(json.main.temp * 9/5 - 459.67)}°F`, true) .addField('Temperature:', `${tempCelcius}°C | ${Math.round(json.main.temp * 9/5 - 459.67)}°F`, true)
.addField('Min/Max:', ` .addField('Min/Max:', `
@ -71,7 +70,7 @@ module.exports = class {
.addField('Wind Speed:', `${Math.round(json.wind.speed * 10) / 10}km/h | ${Math.round(json.wind.speed * 10 / 1.609344)}mi/h`, true) .addField('Wind Speed:', `${Math.round(json.wind.speed * 10) / 10}km/h | ${Math.round(json.wind.speed * 10 / 1.609344)}mi/h`, true)
.addField('Wind Direction:', windrose.getPoint(json.wind.deg).name, true) .addField('Wind Direction:', windrose.getPoint(json.wind.deg).name, true)
.setFooter('Powered by openweathermap.org'); .setFooter('Powered by openweathermap.org');
return message.channel.send({ embed:embed }); return editMessage.edit({ content: null, embeds: [embed] });
} else { } else {
if (json.message && json.message === 'city not found') { if (json.message && json.message === 'city not found') {
return message.channel.send(`${client.config.emojis.userError} You provided an invalid city name. Maybe check your spelling?`); return message.channel.send(`${client.config.emojis.userError} You provided an invalid city name. Maybe check your spelling?`);

View file

@ -51,6 +51,10 @@ class Functions {
return role; return role;
} }
searchMembers (guild, input) {
}
embedColor (guild, member) { embedColor (guild, member) {
if (!member) { if (!member) {
return guild.members.cache.get(this.client.user.id).displayHexColor; return guild.members.cache.get(this.client.user.id).displayHexColor;