From 2867fcf35da2bbf453872e01d0930bc114e1e1fd Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Tue, 5 Feb 2019 13:15:05 +0000 Subject: [PATCH] Forgot to remove forecast --- README.md | 3 +-- commands/search/forecast.js | 54 ------------------------------------- commands/search/weather.js | 2 +- package.json | 2 +- 4 files changed, 3 insertions(+), 58 deletions(-) delete mode 100644 commands/search/forecast.js diff --git a/README.md b/README.md index 04d1ddbe..009c8cb1 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Xiao is a Discord bot coded in JavaScript with 7. Run `npm i -g pm2` to install PM2. 8. Run `pm2 start Xiao.js --name xiao` to run the bot. -## Commands (332) +## Commands (331) ### Utility: * **eval:** Executes JavaScript code. @@ -167,7 +167,6 @@ Xiao is a Discord bot coded in JavaScript with * **eshop:** Searches the Nintendo eShop for your query. * **esrb:** Searches ESRB for your query. * **flickr:** Searches Flickr for your query. -* **forecast:** Responds with the seven-day forecast for a specific location. * **giphy:** Searches Giphy for your query. * **github:** Responds with information on a GitHub repository. * **google-autofill:** Responds with a list of the Google Autofill results for a particular query. diff --git a/commands/search/forecast.js b/commands/search/forecast.js deleted file mode 100644 index f9befd68..00000000 --- a/commands/search/forecast.js +++ /dev/null @@ -1,54 +0,0 @@ -const Command = require('../../structures/Command'); -const { stripIndents } = require('common-tags'); -const { MessageEmbed } = require('discord.js'); -const request = require('node-superfetch'); - -module.exports = class ForecastCommand extends Command { - constructor(client) { - super(client, { - name: 'forecast', - aliases: ['yahoo-forecast', 'weather-forecast', 'yahoo-weather-forecast'], - group: 'search', - memberName: 'forecast', - description: 'Responds with the seven-day forecast for a specific location.', - clientPermissions: ['EMBED_LINKS'], - args: [ - { - key: 'location', - prompt: 'What location would you like to get the forecast for?', - type: 'string' - } - ] - }); - } - - async run(msg, { location }) { - try { - const { body } = await request - .get('https://query.yahooapis.com/v1/public/yql') - .query({ - // eslint-disable-next-line max-len - q: `select * from weather.forecast where u='f' AND woeid in (select woeid from geo.places(1) where text="${location}")`, - format: 'json' - }); - if (!body.query.count) return msg.say('Could not find any results.'); - const data = body.query.results.channel; - const embed = new MessageEmbed() - .setColor(0x0000FF) - .setAuthor(data.title, 'https://i.imgur.com/IYF2Pfa.jpg', 'https://www.yahoo.com/news/weather') - .setURL(data.link) - .setTimestamp(); - for (let i = 0; i < 7; i++) { - const forecast = data.item.forecast[i]; - embed.addField(`❯ ${forecast.day} - ${forecast.date}`, stripIndents` - **High:** ${forecast.high}°F - **Low:** ${forecast.low}°F - **Condition:** ${forecast.text} - `); - } - return msg.embed(embed); - } catch (err) { - return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); - } - } -}; diff --git a/commands/search/weather.js b/commands/search/weather.js index 7e06db95..5f8e9805 100644 --- a/commands/search/weather.js +++ b/commands/search/weather.js @@ -7,7 +7,7 @@ module.exports = class WeatherCommand extends Command { constructor(client) { super(client, { name: 'weather', - aliases: ['open-weather-map'], + aliases: ['open-weather-map', 'owm'], group: 'search', memberName: 'weather', description: 'Responds with weather information for a specific location.', diff --git a/package.json b/package.json index 30eafede..54bdd57a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "100.0.1", + "version": "101.0.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {