changes for eris + new loading UX
This commit is contained in:
parent
9231fcc671
commit
022ec6b999
18 changed files with 84 additions and 81 deletions
|
@ -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?`);
|
||||
|
|
|
@ -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 <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)
|
||||
.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]);
|
||||
|
||||
|
|
|
@ -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] });
|
||||
}
|
||||
};
|
|
@ -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}`);
|
||||
});
|
||||
}
|
||||
};
|
|
@ -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}`);
|
||||
}
|
||||
}
|
||||
};
|
|
@ -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] });
|
||||
});
|
||||
}
|
||||
};
|
|
@ -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] });
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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] });
|
||||
});
|
||||
}
|
||||
};
|
|
@ -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] });
|
||||
});
|
||||
}
|
||||
};
|
|
@ -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] });
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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] });
|
||||
}
|
||||
};
|
|
@ -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] });
|
||||
}
|
||||
};
|
|
@ -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] });
|
||||
}
|
||||
};
|
|
@ -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?`);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue