fix a bunch of stuff that is bad practice

This commit is contained in:
Emily 2022-12-24 22:55:08 +11:00
parent fa0be297ba
commit 9e77c291cb
8 changed files with 14 additions and 14 deletions

View File

@ -37,8 +37,8 @@ module.exports = class About extends Command {
const embed = new client.EmbedBuilder()
.setTitle('About me')
.setThumbnail(client.user.avatarURL({format: 'png'}))
.setColor(bot.user.hexAccentColor ?? bot.displayHexColor)
.addFields([
.setColor(bot.displayHexColor)
.addFields(
{
name: 'General',
value: `» Users: \`${userCount}\`\n» Servers: \`${client.guilds.cache.size}\`\n» Commands: \`${client.commands.size}\`\n» Uptime: \`${uptime}\``,
@ -49,7 +49,7 @@ module.exports = class About extends Command {
value: `» RAM Usage: \`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB\`\n» Woomy version: \`v${client.version} ${build}\`\n» discord.js version: \`v${version}\`\n» node.js version: \`${process.version}\``,
inline: true
}
])
)
.setFooter({ text: 'Made in Australia'});
return interaction.reply({ embeds: [embed], components: [links] });

View File

@ -64,7 +64,7 @@ module.exports = class Help extends Command {
const command = await client.commands.get(input.value);
const embed = new client.EmbedBuilder()
.setTitle(`${command.category} -> ${command.name.toProperCase()}`)
.setColor(bot.user.hexAccentColor ?? bot.displayHexColor)
.setColor(bot.displayHexColor)
.setDescription(command.description)
.setFooter({ text: '<> = required, / = either/or, [] = optional'});

View File

@ -69,7 +69,7 @@ module.exports = class Garfield extends Command {
.then(json => {
const embed = new client.EmbedBuilder()
.setTitle(`#${json.data.number}: ${json.data.name}`)
.setColor(bot.user.hexAccentColor ?? bot.displayHexColor)
.setColor(bot.displayHexColor)
.setImage(json.data.image.src);
interaction.editReply({ embeds: [embed] });
})

View File

@ -11,7 +11,7 @@ module.exports = class Inspire extends Command {
}
async run (client, interaction, data) { //eslint-disable-line no-unused-vars
interaction.deferReply();
await interaction.deferReply();
fetch('http://inspirobot.me/api?generate=true', { headers: { 'User-Agent': client.config.userAgent }})
.then(res => res.text())
.then(body => interaction.editReply(body))

View File

@ -28,6 +28,6 @@ module.exports = class Avatar extends Command {
.setDescription(`[Global avatar](${user.avatarURL({extension: 'png', 'size': 4096})})`)
.setImage(member.displayAvatarURL({extension: 'png', 'size': 4096}));
await interaction.reply({embeds: [embed]});
interaction.reply({embeds: [embed]});
}
};

View File

@ -47,7 +47,7 @@ module.exports = class Avatar extends Command {
.setColor(client.functions.embedColor(guild))
.setTitle(guild.name)
.setThumbnail(guild.iconURL({extension: 'png', 'size': 4096}))
.addFields([
.addFields(
{
name: 'ID', value: guild.id, inline: true
},
@ -84,7 +84,7 @@ module.exports = class Avatar extends Command {
{
name: 'Features', value: guild.features.join(', ')
}
]);
);
interaction.reply({ embeds: [embed] });
}
};

View File

@ -44,7 +44,7 @@ module.exports = class Avatar extends Command {
.setTitle(member.user.username + '#' + member.user.discriminator)
.setColor(user.hexAccentColor ?? member.displayHexColor)
.setThumbnail(member.displayAvatarURL({extension: 'png', 'size': 4096}))
.addFields([
.addFields(
{
name: 'Display Name', value: member.nick || user.username, inline: true
},
@ -63,10 +63,10 @@ module.exports = class Avatar extends Command {
{
name: 'Joined Discord', value: time(user.createdAt, 'D') + time(user.createdAt, 'R'), inline: true
}
]);
);
if (badges.length > 0) {
embed.setDescription(badges.join(' '));
}
return await interaction.reply({embeds: [embed]});
return interaction.reply({embeds: [embed]});
}
};

View File

@ -64,7 +64,7 @@ module.exports = class Weather extends Command {
.setTitle('Current conditions in ' + city.toProperCase() + ', ' + ISO2.code[json.sys.country])
.setThumbnail(`https://openweathermap.org/img/wn/${json.weather[0].icon}@4x.png`)
.setColor(embedColor)
.addFields([
.addFields(
{ name: 'Condition:', value: json.weather[0].main, inline: true },
{ name: 'Temperature:', value: `${tempCelsius}°C ・ ${Math.round(json.main.temp * 9/5 - 459.67)}°F`, inline: true },
{ name: 'Min/Max:', value:`
@ -74,7 +74,7 @@ module.exports = class Weather extends Command {
{ name: 'Humidity:', value: `${json.main.humidity}%`, inline: true },
{ name: 'Wind Speed:', value: `${Math.round(json.wind.speed * 10) / 10}km/h ・ ${Math.round(json.wind.speed * 10 / 1.609344)}mi/h`, inline: true },
{ name: 'Wind Direction:', value: windrose.getPoint(json.wind.deg).name, inline: true}
])
)
.setFooter({ text: 'Powered by openweathermap.org'});
return interaction.reply({embeds: [embed]});