diff --git a/commands/fun/weather.js b/commands/fun/weather.js deleted file mode 100644 index 4080a75..0000000 --- a/commands/fun/weather.js +++ /dev/null @@ -1,37 +0,0 @@ -const { Command } = require('discord.js-commando'); -const Discord = require('discord.js'); -const snekfetch = require('snekfetch'); -const { openweatherAPI } = require('../../config.json'); -module.exports = class WeatherCommand extends Command { - constructor(client) { - super(client, { - name: 'weather', - group: 'fun', - memberName: 'weather', - description: `Choose the city you want to know the weather`, - args: [ - { - key: 'city', - prompt: 'city', - type: 'string', - } - ] - }); - } - - async run(message, { city }) { - const { body } = await snekfetch.get(`https://api.openweathermap.org/data/2.5/weather?q=${city}&units=metric&APPID=${openweatherAPI}`); - if (!body.main.temp) { - return message.say(`No results found for **${city}**`); - } - const weatherEmbed = new Discord.RichEmbed() - .setColor("#ff9900") - .setTitle(body.name + ' current weather') - .setDescription(body.main.temp + '°c') - .addField('Temp min', body.main.temp_min + '°c') - .addField('Temp max', body.main.temp_max + '°c') - - - message.say(weatherEmbed); - } -}; \ No newline at end of file diff --git a/config-exemple.json b/config-exemple.json index a92b0c1..86ee658 100644 --- a/config-exemple.json +++ b/config-exemple.json @@ -5,5 +5,4 @@ "botID": "ID of the bot", "statsChannel": "ID of the channel that the bot are going to post its stats", "supportServer": "Invite link for the support server of the bot", - "openweatherAPI": "open weather api key" } \ No newline at end of file