Bug Fixes

This commit is contained in:
Daniel Odendahl Jr
2017-04-16 01:25:42 +00:00
parent 8074fe51bd
commit fb9f723f1c
4 changed files with 5 additions and 5 deletions
+1 -2
View File
@@ -23,8 +23,7 @@ module.exports = class TodayCommand extends Command {
} }
try { try {
const response = await snekfetch const response = await snekfetch
.get('http://history.muffinlabs.com/date') .get('http://history.muffinlabs.com/date');
.buffer();
const parsedResponse = JSON.parse(response.text); const parsedResponse = JSON.parse(response.text);
const events = parsedResponse.data.Events; const events = parsedResponse.data.Events;
const randomNumber = Math.floor(Math.random() * events.length); const randomNumber = Math.floor(Math.random() * events.length);
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = class ForecastCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!'); if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
} }
const location = encodeURIComponent(args.locationQ); const location = args.locationQ;
try { try {
const response = await snekfetch const response = await snekfetch
.get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${location}")&format=json`); .get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${location}")&format=json`);
+1 -1
View File
@@ -23,7 +23,7 @@ module.exports = class WeatherCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!'); if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
} }
const location = encodeURIComponent(args.locationQ); const location = args.locationQ;
try { try {
const response = await snekfetch const response = await snekfetch
.get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${location}")&format=json`); .get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${location}")&format=json`);
+2 -1
View File
@@ -23,7 +23,8 @@ module.exports = class WikipediaCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!'); if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
} }
const query = encodeURIComponent(args.query.replace(/[)]/g, '%29')); let query = encodeURIComponent(args.query);
query = query.replace(/[)]/g, '%29');
try { try {
const response = await snekfetch const response = await snekfetch
.get(`https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&titles=${query}&exintro=&explaintext=&redirects=&formatversion=2`); .get(`https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&titles=${query}&exintro=&explaintext=&redirects=&formatversion=2`);