From 022ec6b999d94cb39cea9e82bd804ab6fb766012 Mon Sep 17 00:00:00 2001 From: mudkipscience Date: Sat, 17 Jul 2021 15:55:18 +1000 Subject: [PATCH] changes for eris + new loading UX --- bot/commands/Bot/help.js | 18 +++++++++--------- bot/commands/Configuration/blocklist.js | 10 +++++----- bot/commands/Fun/colour.js | 6 +++--- bot/commands/Fun/garfield.js | 14 +++++++------- bot/commands/Fun/inspire.js | 8 ++++---- bot/commands/Pokemon/ability.js | 12 ++++++------ bot/commands/Pokemon/effective.js | 8 ++++---- bot/commands/Pokemon/item.js | 10 +++++----- bot/commands/Pokemon/move.js | 10 +++++----- bot/commands/Pokemon/pokemon.js | 8 ++++---- bot/commands/Splatoon/salmonrun.js | 12 ++++++------ bot/commands/Splatoon/splatnet.js | 4 ++-- bot/commands/Splatoon/splatoonmaps.js | 8 ++++---- bot/commands/Utility/avatar.js | 8 ++++---- bot/commands/Utility/serverinfo.js | 6 +++--- bot/commands/Utility/userinfo.js | 8 ++++---- bot/commands/Utility/weather.js | 11 +++++------ bot/util/functions.js | 4 ++++ 18 files changed, 84 insertions(+), 81 deletions(-) diff --git a/bot/commands/Bot/help.js b/bot/commands/Bot/help.js index 7321e29..b1cbdab 100644 --- a/bot/commands/Bot/help.js +++ b/bot/commands/Bot/help.js @@ -30,9 +30,9 @@ module.exports = class { }); if (!args[0]) { - const embed = new client.RichEmbed(); + const embed = new client.MessageEmbed(); embed.setTitle('Help & Commands'); - embed.setColour(client.functions.displayHexColour(message.guild)); + embed.setColor(client.functions.embedColor(message.guild)); embed.setDescription( ` » 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'); - return message.channel.send({ embed: embed }); + return message.channel.send({ embeds: [embed] }); } const cat = args[0].toProperCase(); @@ -64,20 +64,20 @@ module.exports = class { 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) - .setColour(client.functions.displayHexColour(message.guild)) + .setColor(client.functions.embedColor(message.guild)) .setDescription(cmds) .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)) { 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()) - .setColour(client.functions.displayHexColour(message.guild)) + .setColor(client.functions.embedColor(message.guild)) .setDescription(command.help.description) .addField('Format:', `\`${message.prefix + command.name} ${command.help.arguments}`.trim() + '`'); 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); embed.addField('Cooldown:', `${command.cooldown / 1000} seconds`, true); 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?`); diff --git a/bot/commands/Configuration/blocklist.js b/bot/commands/Configuration/blocklist.js index 6a811cc..e6628dc 100644 --- a/bot/commands/Configuration/blocklist.js +++ b/bot/commands/Configuration/blocklist.js @@ -20,18 +20,18 @@ module.exports = class { if (!action || action.toLowerCase() === 'list') { const list = []; 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}`); } if (list.length === 0) return message.channel.send('The server blocklist is currently empty. Use `blocklist add ` to add people to the blocklist!'); - const embed = new client.RichEmbed() + const embed = new client.MessageEmbed() .setTitle('Users on blocklist: ' + data.guild.blocklist.length) .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; } @@ -49,7 +49,7 @@ module.exports = class { let member; 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 { member = await client.functions.validateUserID(message.guild, user[0]); diff --git a/bot/commands/Fun/colour.js b/bot/commands/Fun/colour.js index 5d4cb27..f67e129 100644 --- a/bot/commands/Fun/colour.js +++ b/bot/commands/Fun/colour.js @@ -36,11 +36,11 @@ module.exports = class { } } - const embed = new client.RichEmbed() + const embed = new client.MessageEmbed() .setTitle(colour) - .setColour(colour) + .setColor(colour) .setImage(`https://fakeimg.pl/256x256/${colour.replace('#', '')}/?text=%20`); - message.channel.send({ embed: embed }); + message.channel.send({ embeds: [embed] }); } }; \ No newline at end of file diff --git a/bot/commands/Fun/garfield.js b/bot/commands/Fun/garfield.js index f44e709..57fdf66 100644 --- a/bot/commands/Fun/garfield.js +++ b/bot/commands/Fun/garfield.js @@ -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'; if (args[0] && args[0].toLowerCase() === 'daily') date = new Date(); - message.channel.sendTyping(); - fetch('https://garfield-comics.glitch.me/~SRoMG/?date=' + date, { headers: { 'User-Agent': client.config.userAgent }}) + 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 }}) .then(res => res.json()) .then(json => { - const embed = new client.RichEmbed() + const embed = new client.MessageEmbed() .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) .setImage(json.data.image.src); - message.channel.send({ embed: embed }); + editMessage.edit({ embeds: [embed] }); }) .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}`); }); } }; \ No newline at end of file diff --git a/bot/commands/Fun/inspire.js b/bot/commands/Fun/inspire.js index f05a502..d2552d8 100644 --- a/bot/commands/Fun/inspire.js +++ b/bot/commands/Fun/inspire.js @@ -18,14 +18,14 @@ module.exports = class { }; } - run (client, message, args, data) { //eslint-disable-line no-unused-vars - message.channel.sendTyping(); + async run (client, message, args, data) { //eslint-disable-line no-unused-vars + const editMessage = await message.channel.send(`${client.config.emojis.loading} Please wait...`); try { fetch('http://inspirobot.me/api?generate=true', { headers: { 'User-Agent': client.config.userAgent }}) .then(res => res.text()) - .then(body => message.channel.send(body)); + .then(body => editMessage.edit(body)); } 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}`); } } }; \ No newline at end of file diff --git a/bot/commands/Pokemon/ability.js b/bot/commands/Pokemon/ability.js index 38dce64..4cc6af9 100644 --- a/bot/commands/Pokemon/ability.js +++ b/bot/commands/Pokemon/ability.js @@ -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( `${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(); @@ -52,7 +52,7 @@ module.exports = class { if (json.errors) { json.errors.forEach(error => { 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?` ); } else { @@ -70,8 +70,8 @@ module.exports = class { fieldEffects = ` Outside of battle, ${ability.isFieldAbility}`; } - const embed = new client.RichEmbed() - .setColour(client.functions.displayHexColour(message.guild)) + const embed = new client.MessageEmbed() + .setColor(client.functions.embedColor(message.guild)) .setTitle(ability.name.toProperCase()); if (ability.desc) { embed.setDescription(ability.desc + fieldEffects); @@ -79,7 +79,7 @@ module.exports = class { embed.setDescription(ability.shortDesc + fieldEffects); } embed.addField('External Resources:', `[Bulbapedia](${ability.bulbapediaPage}) • [Serebii](${ability.serebiiPage}) • [Smogon](${ability.smogonPage})`); - message.channel.send({ embed: embed }); + editMessage.edit({ content: null, embeds: [embed] }); }); } }; \ No newline at end of file diff --git a/bot/commands/Pokemon/effective.js b/bot/commands/Pokemon/effective.js index 43552c9..b14ee4e 100644 --- a/bot/commands/Pokemon/effective.js +++ b/bot/commands/Pokemon/effective.js @@ -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}\`` ); - message.channel.sendTyping(); + const editMessage = await message.channel.send(`${client.config.emojis.loading} Please wait...`); let types; @@ -105,8 +105,8 @@ module.exports = class { ${typeMatchup.defending.effectlessTypes.map(type => `\`${type.toProperCase()}\``).join(' ')} `; - const embed = new client.RichEmbed() - .setColour(colours[types[0].toProperCase()]) + const embed = new client.MessageEmbed() + .setColor(colours[types[0].toProperCase()]) .setTitle('Type effectiveness of ' + types.map(type => type.toProperCase()).join(' and ')) .addField('Offensive:', ` **Super-effective:** @@ -120,7 +120,7 @@ module.exports = class { **Resistances:** ${this.parseResistedTypes(typeMatchup.defending.resistedTypes, typeMatchup.defending.doubleResistedTypes)}${immune} `); - message.channel.send({ embed: embed }); + editMessage.edit({ content: null, embeds: [embed] }); }); } diff --git a/bot/commands/Pokemon/item.js b/bot/commands/Pokemon/item.js index 29c4d4c..da347ce 100644 --- a/bot/commands/Pokemon/item.js +++ b/bot/commands/Pokemon/item.js @@ -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( `${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(); @@ -66,8 +66,8 @@ module.exports = class { const item = json.data.getItemDetailsByFuzzy; - const embed = new client.RichEmbed() - .setColour(client.functions.displayHexColour(message.guild)) + const embed = new client.MessageEmbed() + .setColor(client.functions.embedColor(message.guild)) .setTitle(item.name) .setThumbnail(item.sprite) .addField('External Resources:', `[Bulbapedia](${item.bulbapediaPage}) • [Serebii](${item.serebiiPage}) • [Smogon](${item.smogonPage})`); @@ -76,7 +76,7 @@ module.exports = class { } else { embed.setDescription(`${item.shortDesc} Added in Generation ${item.generationIntroduced}.`); } - message.channel.send({ embed: embed }); + editMessage.edit({ content: null, embeds: [embed] }); }); } }; \ No newline at end of file diff --git a/bot/commands/Pokemon/move.js b/bot/commands/Pokemon/move.js index d711a10..62dc56f 100644 --- a/bot/commands/Pokemon/move.js +++ b/bot/commands/Pokemon/move.js @@ -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( `${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(); @@ -91,8 +91,8 @@ module.exports = class { let fieldEffects = ''; if (move.isFieldMove) fieldEffects = ' Outside of battle, ' + move.isFieldMove; - const embed = new client.RichEmbed() - .setColour(colours[move.type]) + const embed = new client.MessageEmbed() + .setColor(colours[move.type]) .setTitle(move.name.toProperCase() + suffix); if (move.desc) { 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.contestType !== null) embed.addField('Contest Type', move.contestType, true); embed.addField('External Resources:', `[Bulbapedia](${move.bulbapediaPage}) • [Serebii](${move.serebiiPage}) • [Smogon](${move.smogonPage})`); - message.channel.send({ embed: embed }); + editMessage.edit({ content: null, embeds: [embed] }); }); } }; \ No newline at end of file diff --git a/bot/commands/Pokemon/pokemon.js b/bot/commands/Pokemon/pokemon.js index 8a5884e..d890ea9 100644 --- a/bot/commands/Pokemon/pokemon.js +++ b/bot/commands/Pokemon/pokemon.js @@ -24,7 +24,7 @@ module.exports = class { `${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(); @@ -92,8 +92,8 @@ module.exports = class { formes = formes.split().concat(pokemon.cosmeticFormes); } } - const embed = new client.RichEmbed() - .setColour(colours[pokemon.types[0]]) + const embed = new client.MessageEmbed() + .setColor(colours[pokemon.types[0]]) .setTitle(`${pokemon.species.toProperCase()} (No. ${pokemon.num})`) .setDescription(pokemon.flavorTexts[0].flavor) .setThumbnail(sprite) @@ -108,7 +108,7 @@ module.exports = class { embed.addField('Egg Groups:', pokemon.eggGroups.join(', '), true); embed.addField('Smogon Tier:', pokemon.smogonTier, true); embed.addField('External Resources:', `[Bulbapedia](${pokemon.bulbapediaPage}) • [Serebii](${pokemon.serebiiPage}) • [Smogon](${pokemon.smogonPage})`); - message.channel.send({ embed: embed }); + editMessage.edit({ content: null, embeds: [embed] }); }); } diff --git a/bot/commands/Splatoon/salmonrun.js b/bot/commands/Splatoon/salmonrun.js index 1a19c2c..9c9331f 100644 --- a/bot/commands/Splatoon/salmonrun.js +++ b/bot/commands/Splatoon/salmonrun.js @@ -33,18 +33,18 @@ module.exports = class { if ((json.details[0].start_time * 1000) > Date.now() === true) { embeds.push( - new client.RichEmbed() + new client.MessageEmbed() .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) .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`) ); } else { embeds.push( - new client.RichEmbed() + new client.MessageEmbed() .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) .setImage('https://splatoon2.ink/assets/splatnet/'+json.details[0].stage.image) .addField('Map', json.details[0].stage.name, true) @@ -55,9 +55,9 @@ module.exports = class { } embeds.push( - new client.RichEmbed() + new client.MessageEmbed() .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) .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) diff --git a/bot/commands/Splatoon/splatnet.js b/bot/commands/Splatoon/splatnet.js index b1c02de..ea35b0d 100644 --- a/bot/commands/Splatoon/splatnet.js +++ b/bot/commands/Splatoon/splatnet.js @@ -28,10 +28,10 @@ module.exports = class { const embeds = []; 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) .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('Brand', json.merchandises[i].gear.brand.name, true) .addField('Ability Slots', (json.merchandises[i].gear.rarity + 1).toString(), true) diff --git a/bot/commands/Splatoon/splatoonmaps.js b/bot/commands/Splatoon/splatoonmaps.js index 9c8c1e0..62c54ee 100644 --- a/bot/commands/Splatoon/splatoonmaps.js +++ b/bot/commands/Splatoon/splatoonmaps.js @@ -27,9 +27,9 @@ module.exports = class { .then(json => { const embeds = [ - new client.RichEmbed() + new client.MessageEmbed() .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(`<: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) @@ -37,9 +37,9 @@ module.exports = class { ]; for ( let i = 1; i < json.regular.length; i++ ) { - const embed = new client.RichEmbed() + const embed = new client.MessageEmbed() .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(`<: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) diff --git a/bot/commands/Utility/avatar.js b/bot/commands/Utility/avatar.js index 1eb765c..1190003 100644 --- a/bot/commands/Utility/avatar.js +++ b/bot/commands/Utility/avatar.js @@ -22,7 +22,7 @@ module.exports = class { if (args[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 { 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) - .setColour(client.functions.displayHexColour(message.guild, member)) + .setColor(client.functions.embedColor(message.guild, member)) .setImage(member.user.avatarURL); - message.channel.send({ embed: embed }); + message.channel.send({ embeds: [embed] }); } }; \ No newline at end of file diff --git a/bot/commands/Utility/serverinfo.js b/bot/commands/Utility/serverinfo.js index 062d405..ddba662 100644 --- a/bot/commands/Utility/serverinfo.js +++ b/bot/commands/Utility/serverinfo.js @@ -19,8 +19,8 @@ module.exports = class { run (client, message, args, data) { //eslint-disable-line no-unused-vars const guild = message.guild; - const embed = new client.RichEmbed() - .setColour(client.functions.displayHexColour(message.guild)) + const embed = new client.MessageEmbed() + .setColor(client.functions.embedColor(message.guild)) .setTitle(guild.name) .setThumbnail(guild.iconURL) .addField('ID', guild.id, true) @@ -29,6 +29,6 @@ module.exports = class { .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('Channels', `${guild.channels.size} ()`) - message.channel.send({ embed: embed }); + message.channel.send({ embeds: [embed] }); } }; \ No newline at end of file diff --git a/bot/commands/Utility/userinfo.js b/bot/commands/Utility/userinfo.js index 27f42c3..376ca5d 100644 --- a/bot/commands/Utility/userinfo.js +++ b/bot/commands/Utility/userinfo.js @@ -24,7 +24,7 @@ module.exports = class { if (args[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 { member = await client.functions.validateUserID(message.guild, args[0]); @@ -61,9 +61,9 @@ module.exports = class { roles.push(`<@&${roleID}>`); } - const embed = new client.RichEmbed() + const embed = new client.MessageEmbed() .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) .addField('Display Name', member.nick || member.user.username, 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); if (badges.length > 0) embed.setDescription(badges.join(' ')); - message.channel.send({ embed: embed }); + message.channel.send({ embeds: [embed] }); } }; \ No newline at end of file diff --git a/bot/commands/Utility/weather.js b/bot/commands/Utility/weather.js index c250112..21d7f33 100644 --- a/bot/commands/Utility/weather.js +++ b/bot/commands/Utility/weather.js @@ -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; let city = args.join(' ').toProperCase(); @@ -35,10 +35,9 @@ module.exports = class { } else { 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 }}) .then(res => res.json()) .then(json => { @@ -57,10 +56,10 @@ module.exports = class { embedColour = '#ff614f'; } - const embed = new client.RichEmbed() + const embed = new client.MessageEmbed() .setTitle(`Weather for ${city + ', ' + ISO2.code[json.sys.country]}`) .setThumbnail(`https://openweathermap.org/img/wn/${json.weather[0].icon}@4x.png`) - .setColour(embedColour) + .setColor(embedColour) .addField('Condition:', json.weather[0].main, true) .addField('Temperature:', `${tempCelcius}°C | ${Math.round(json.main.temp * 9/5 - 459.67)}°F`, true) .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 Direction:', windrose.getPoint(json.wind.deg).name, true) .setFooter('Powered by openweathermap.org'); - return message.channel.send({ embed:embed }); + return editMessage.edit({ content: null, embeds: [embed] }); } else { 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?`); diff --git a/bot/util/functions.js b/bot/util/functions.js index 95de22c..e8d5656 100644 --- a/bot/util/functions.js +++ b/bot/util/functions.js @@ -51,6 +51,10 @@ class Functions { return role; } + searchMembers (guild, input) { + + } + embedColor (guild, member) { if (!member) { return guild.members.cache.get(this.client.user.id).displayHexColor;