Compare commits

..

No commits in common. "d93d42a131221b8237186eff002b86eb936c8bb5" and "3159c72439bb0cdabf4e14cdb50ec35b71daf6f4" have entirely different histories.

5 changed files with 20 additions and 27 deletions

View file

@ -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
}
};

View file

@ -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}\``);
});
};

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}