This commit is contained in:
Daniel Odendahl Jr
2017-12-13 16:08:58 +00:00
parent 52deb3ed0a
commit 5ab259366b
2 changed files with 8 additions and 8 deletions
+4 -4
View File
@@ -10,11 +10,11 @@ module.exports = class ForecastCommand extends Command {
aliases: ['yahoo-forecast', 'weather-forecast', 'yahoo-weather-forecast'],
group: 'search',
memberName: 'forecast',
description: 'Responds with the seven-day forecast for a specified location.',
description: 'Responds with the seven-day forecast for a specific location.',
clientPermissions: ['EMBED_LINKS'],
args: [
{
key: 'query',
key: 'location',
prompt: 'What location would you like to get the forecast for?',
type: 'string'
}
@@ -22,13 +22,13 @@ module.exports = class ForecastCommand extends Command {
});
}
async run(msg, { query }) {
async run(msg, { location }) {
try {
const { body } = await snekfetch
.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="${query}")`,
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.');
+4 -4
View File
@@ -9,11 +9,11 @@ module.exports = class WeatherCommand extends Command {
aliases: ['yahoo-weather'],
group: 'search',
memberName: 'weather',
description: 'Responds with weather information for a specified location.',
description: 'Responds with weather information for a specific location.',
clientPermissions: ['EMBED_LINKS'],
args: [
{
key: 'query',
key: 'location',
prompt: 'What location would you like to get the weather of?',
type: 'string'
}
@@ -21,13 +21,13 @@ module.exports = class WeatherCommand extends Command {
});
}
async run(msg, { query }) {
async run(msg, { location }) {
try {
const { body } = await snekfetch
.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="${query}")`,
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.');