diff --git a/bot/base/Event.js b/bot/base/Event.js index 3dc70d9..b725fed 100644 --- a/bot/base/Event.js +++ b/bot/base/Event.js @@ -1,9 +1,9 @@ -module.exports = class Event { +module.exports = class { constructor (wsEvent) { this.wsEvent = wsEvent; } - run (client) { //eslint-disable-line no-unused-vars + async run (client) { //eslint-disable-line no-unused-vars } }; \ No newline at end of file diff --git a/bot/commands/Utility/weather.js b/bot/commands/Utility/weather.js index d40feab..ea2c5cf 100644 --- a/bot/commands/Utility/weather.js +++ b/bot/commands/Utility/weather.js @@ -28,6 +28,8 @@ module.exports = class Weather extends Command { async run (client, interaction, data) { //eslint-disable-line no-unused-vars + await interaction.deferReply(); + const city = await interaction.options.get('city').value; let country = await interaction.options.get('country'); let countryCode = ""; @@ -66,31 +68,27 @@ module.exports = class Weather extends Command { .setColor(embedColor) .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: 'Temperature:', value: `${tempCelsius}°C | ${Math.round(json.main.temp * 9/5 - 459.67)}°F`, inline: true }, { name: 'Min/Max:', value:` - ${Math.round(json.main.temp_min - 273.15)}°C ・ ${Math.round(json.main.temp_max - 273.15)}°C - ${Math.round(json.main.temp_min * 9/5 - 459.67)}°F ・ ${Math.round(json.main.temp_max * 9/5 - 459.67)}°F + ${Math.round(json.main.temp_min - 273.15)}°C - ${Math.round(json.main.temp_max - 273.15)}°C + ${Math.round(json.main.temp_min * 9/5 - 459.67)}°F - ${Math.round(json.main.temp_max * 9/5 - 459.67)}°F `, 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} ]) .setFooter({ text: 'Powered by openweathermap.org'}); - return interaction.reply({embeds: [embed]}); + return interaction.editReply({embeds: [embed]}); } else { if (json.message && json.message === 'city not found') { - return interaction.reply({ - content: `${client.config.emojis.userError} ${city.toProperCase()} is not listed in my sources.`, - ephemeral: true - }); - }; - client.logger.error('WEATHER_COMMAND_ERROR', `API Error: ${json}`) - return interaction.reply({ - content: `${client.config.emojis.botError} API error occurred: \`code ${json.cod}\``, - ephemeral: true - }); - }; + return interaction.editReply(`${client.config.emojis.userError} ${city.toProperCase()} is not listed in my sources.`); + } + return interaction.editReply(`${client.config.emojis.botError} API error occurred: \`code ${json.cod}: ${json.message}\``); + } + }) + .catch(err => { + return interaction.editReply(`${client.config.emojis.botError} An error has occurred: \`${err.stack}\``); }); }; diff --git a/bot/event_modules/interactionCreate/interactionHandler.js b/bot/event_modules/interactionCreate/interactionHandler.js index 246612c..92c4be3 100644 --- a/bot/event_modules/interactionCreate/interactionHandler.js +++ b/bot/event_modules/interactionCreate/interactionHandler.js @@ -1,7 +1,5 @@ -const Event = require("../../base/Event.js"); -module.exports = class InteractionHandler extends Event { +module.exports = class { constructor (wsEvent) { - super (wsEvent); this.wsEvent = wsEvent; } diff --git a/bot/event_modules/ready/activity.js b/bot/event_modules/ready/activity.js index 04083f0..ea72c7a 100644 --- a/bot/event_modules/ready/activity.js +++ b/bot/event_modules/ready/activity.js @@ -1,8 +1,7 @@ -const Event = require("../../base/Event.js"); const activities = require('../../assets/activities.json'); -module.exports = class Activity extends Event { + +module.exports = class { constructor (wsEvent) { - super (wsEvent); this.wsEvent = wsEvent; } diff --git a/bot/event_modules/ready/logReady.js b/bot/event_modules/ready/logReady.js index fe70e7a..6395eab 100644 --- a/bot/event_modules/ready/logReady.js +++ b/bot/event_modules/ready/logReady.js @@ -1,7 +1,5 @@ -const Event = require("../../base/Event.js"); -module.exports = class Ready extends Event { +module.exports = class { constructor (wsEvent) { - super (wsEvent); this.wsEvent = wsEvent; }