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() const embed = new client.EmbedBuilder()
.setTitle('About me') .setTitle('About me')
.setThumbnail(client.user.avatarURL({format: 'png'})) .setThumbnail(client.user.avatarURL({format: 'png'}))
.setColor(bot.user.hexAccentColor ?? bot.displayHexColor) .setColor(bot.displayHexColor)
.addFields([ .addFields(
{ {
name: 'General', name: 'General',
value: `» Users: \`${userCount}\`\n» Servers: \`${client.guilds.cache.size}\`\n» Commands: \`${client.commands.size}\`\n» Uptime: \`${uptime}\``, 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}\``, 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 inline: true
} }
]) )
.setFooter({ text: 'Made in Australia'}); .setFooter({ text: 'Made in Australia'});
return interaction.reply({ embeds: [embed], components: [links] }); 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 command = await client.commands.get(input.value);
const embed = new client.EmbedBuilder() const embed = new client.EmbedBuilder()
.setTitle(`${command.category} -> ${command.name.toProperCase()}`) .setTitle(`${command.category} -> ${command.name.toProperCase()}`)
.setColor(bot.user.hexAccentColor ?? bot.displayHexColor) .setColor(bot.displayHexColor)
.setDescription(command.description) .setDescription(command.description)
.setFooter({ text: '<> = required, / = either/or, [] = optional'}); .setFooter({ text: '<> = required, / = either/or, [] = optional'});

View file

@ -69,7 +69,7 @@ module.exports = class Garfield extends Command {
.then(json => { .then(json => {
const embed = new client.EmbedBuilder() const embed = new client.EmbedBuilder()
.setTitle(`#${json.data.number}: ${json.data.name}`) .setTitle(`#${json.data.number}: ${json.data.name}`)
.setColor(bot.user.hexAccentColor ?? bot.displayHexColor) .setColor(bot.displayHexColor)
.setImage(json.data.image.src); .setImage(json.data.image.src);
interaction.editReply({ embeds: [embed] }); 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 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 }}) fetch('http://inspirobot.me/api?generate=true', { headers: { 'User-Agent': client.config.userAgent }})
.then(res => res.text()) .then(res => res.text())
.then(body => interaction.editReply(body)) .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})})`) .setDescription(`[Global avatar](${user.avatarURL({extension: 'png', 'size': 4096})})`)
.setImage(member.displayAvatarURL({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)) .setColor(client.functions.embedColor(guild))
.setTitle(guild.name) .setTitle(guild.name)
.setThumbnail(guild.iconURL({extension: 'png', 'size': 4096})) .setThumbnail(guild.iconURL({extension: 'png', 'size': 4096}))
.addFields([ .addFields(
{ {
name: 'ID', value: guild.id, inline: true name: 'ID', value: guild.id, inline: true
}, },
@ -84,7 +84,7 @@ module.exports = class Avatar extends Command {
{ {
name: 'Features', value: guild.features.join(', ') name: 'Features', value: guild.features.join(', ')
} }
]); );
interaction.reply({ embeds: [embed] }); interaction.reply({ embeds: [embed] });
} }
}; };

View file

@ -44,7 +44,7 @@ module.exports = class Avatar extends Command {
.setTitle(member.user.username + '#' + member.user.discriminator) .setTitle(member.user.username + '#' + member.user.discriminator)
.setColor(user.hexAccentColor ?? member.displayHexColor) .setColor(user.hexAccentColor ?? member.displayHexColor)
.setThumbnail(member.displayAvatarURL({extension: 'png', 'size': 4096})) .setThumbnail(member.displayAvatarURL({extension: 'png', 'size': 4096}))
.addFields([ .addFields(
{ {
name: 'Display Name', value: member.nick || user.username, inline: true 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 name: 'Joined Discord', value: time(user.createdAt, 'D') + time(user.createdAt, 'R'), inline: true
} }
]); );
if (badges.length > 0) { if (badges.length > 0) {
embed.setDescription(badges.join(' ')); 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]) .setTitle('Current conditions in ' + city.toProperCase() + ', ' + 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`)
.setColor(embedColor) .setColor(embedColor)
.addFields([ .addFields(
{ name: 'Condition:', value: json.weather[0].main, inline: true }, { 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: 'Temperature:', value: `${tempCelsius}°C ・ ${Math.round(json.main.temp * 9/5 - 459.67)}°F`, inline: true },
{ name: 'Min/Max:', value:` { name: 'Min/Max:', value:`
@ -74,7 +74,7 @@ module.exports = class Weather extends Command {
{ name: 'Humidity:', value: `${json.main.humidity}%`, inline: true }, { 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 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} { name: 'Wind Direction:', value: windrose.getPoint(json.wind.deg).name, inline: true}
]) )
.setFooter({ text: 'Powered by openweathermap.org'}); .setFooter({ text: 'Powered by openweathermap.org'});
return interaction.reply({embeds: [embed]}); return interaction.reply({embeds: [embed]});