diff --git a/README.md b/README.md
index d4c93908..8ea49e67 100644
--- a/README.md
+++ b/README.md
@@ -60,8 +60,8 @@ served over 10,000 servers with a uniquely devoted fanbase.
* **discord-email-fun-fact**: Responds with a random fun fact from the Discord emails.
* **dog-fact**: Responds with a random dog fact.
* **dog**: Responds with a random dog image.
-* **fact**: Responds with a random fact.
* **fact-core**: Responds with a random Fact Core quote.
+* **fact**: Responds with a random fact.
* **fidget**: Responds with a random image of Fidget.
* **fortune**: Responds with a random fortune.
* **fruit**: Responds with a random fruit.
@@ -328,12 +328,13 @@ served over 10,000 servers with a uniquely devoted fanbase.
* **units**: Converts units to/from other units.
### Server Tags:
-* **tag**: Responds with a tag in this server.
+
* **tag-add**: Adds a tag for this server.
* **tag-edit**: Edits a tag in this server.
* **tag-info**: Responds with detailed information on a tag in this server.
* **tag-remove**: Removes a tag from this server.
* **tag-source**: Responds with the base markdown of a tag in this server.
+* **tag**: Responds with a tag in this server.
### Role Management:
diff --git a/commands/events/doomsday-clock.js b/commands/events/doomsday-clock.js
index d27110f0..0bd09ad8 100644
--- a/commands/events/doomsday-clock.js
+++ b/commands/events/doomsday-clock.js
@@ -14,7 +14,8 @@ module.exports = class DoomsdayClockCommand extends Command {
async run(msg) {
try {
- const { text } = await snekfetch.get('https://thebulletin.org/timeline');
+ const { raw } = await snekfetch.get('https://thebulletin.org/timeline');
+ const text = raw.toString();
const time = text.match(/IT IS (.+) MINUTES TO MIDNIGHT/)[0];
const desc = text.match(/
(.+)<\/span>: (.+)<\/div>/);
return msg.say(stripIndents`
diff --git a/commands/events/neko-atsume-password.js b/commands/events/neko-atsume-password.js
index cddd38e8..dbf33c4b 100644
--- a/commands/events/neko-atsume-password.js
+++ b/commands/events/neko-atsume-password.js
@@ -42,9 +42,9 @@ module.exports = class NekoAtsumePasswordCommand extends Command {
}
async fetchPassword(locale) {
- const { text } = await snekfetch
+ const { raw } = await snekfetch
.get(`http://hpmobile.jp/app/nekoatsume/neko_daily${locale !== 'jp' ? `_${locale}` : ''}.php`);
- const data = text.split(',');
+ const data = raw.toString().split(',');
const date = new Date();
date.setUTCHours(date.getUTCHours() + 9);
return {
diff --git a/commands/events/today-in-history.js b/commands/events/today-in-history.js
index ec1e03f3..17ec5b65 100644
--- a/commands/events/today-in-history.js
+++ b/commands/events/today-in-history.js
@@ -33,8 +33,8 @@ module.exports = class TodayInHistoryCommand extends Command {
async run(msg, { month, day }) {
const date = month && day ? `/${month}/${day}` : '';
try {
- const { text } = await snekfetch.get(`http://history.muffinlabs.com/date${date}`);
- const body = JSON.parse(text);
+ const { raw } = await snekfetch.get(`http://history.muffinlabs.com/date${date}`);
+ const body = JSON.parse(raw.toString());
const events = body.data.Events;
const event = events[Math.floor(Math.random() * events.length)];
const embed = new MessageEmbed()
@@ -47,7 +47,7 @@ module.exports = class TodayInHistoryCommand extends Command {
event.links.map(link => `[${link.title}](${link.link.replace(/\)/g, '%29')})`).join(', '));
return msg.embed(embed);
} catch (err) {
- if (err.status === 404 || err.status === 500) return msg.say('Invalid date.');
+ if (err.statusCode === 404 || err.statusCode === 500) return msg.say('Invalid date.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/games/google-feud.js b/commands/games/google-feud.js
index 3c0311f9..482e2ad2 100644
--- a/commands/games/google-feud.js
+++ b/commands/games/google-feud.js
@@ -66,13 +66,14 @@ module.exports = class GoogleFeudCommand extends Command {
}
async fetchSuggestions(question) {
- const { text } = await snekfetch
+ const { raw } = await snekfetch
.get('https://suggestqueries.google.com/complete/search')
.query({
client: 'firefox',
q: question
});
- const suggestions = JSON.parse(text)[1].filter(suggestion => suggestion.toLowerCase() !== question.toLowerCase());
+ const suggestions = JSON.parse(raw.toString())[1]
+ .filter(suggestion => suggestion.toLowerCase() !== question.toLowerCase());
if (!suggestions.length) return null;
return suggestions.map(suggestion => suggestion.toLowerCase().replace(question.toLowerCase(), '').trim());
}
diff --git a/commands/image-edit/osu-signature.js b/commands/image-edit/osu-signature.js
index f98da5c0..30132c3e 100644
--- a/commands/image-edit/osu-signature.js
+++ b/commands/image-edit/osu-signature.js
@@ -35,7 +35,7 @@ module.exports = class OsuSignatureCommand extends Command {
async run(msg, { user, color }) {
try {
- const { body, text } = await snekfetch
+ const { body, raw } = await snekfetch
.get('https://lemmmy.pw/osusig/sig.php')
.query({
colour: color,
@@ -48,7 +48,7 @@ module.exports = class OsuSignatureCommand extends Command {
onlineindicator: '',
xpbar: ''
});
- if (text.includes('Warning')) return msg.say('Could not find any results.');
+ if (raw.toString().includes('Warning')) return msg.say('Could not find any results.');
return msg.say({ files: [{ attachment: body, name: 'osu-signature.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
diff --git a/commands/image-edit/shields-io-badge.js b/commands/image-edit/shields-io-badge.js
index f0502ad6..cb94bb50 100644
--- a/commands/image-edit/shields-io-badge.js
+++ b/commands/image-edit/shields-io-badge.js
@@ -38,7 +38,7 @@ module.exports = class ShieldsIoBadgeCommand extends Command {
const { body } = await snekfetch.get(`https://img.shields.io/badge/${subject}-${status}-${color}.png`);
return msg.say({ files: [{ attachment: body, name: 'badge.png' }] });
} catch (err) {
- if (err.status === 404) return msg.reply('Could not create the badge...');
+ if (err.statusCode === 404) return msg.reply('Could not create the badge...');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/random/number-fact.js b/commands/random/number-fact.js
index f5cd20a4..c0f8688b 100644
--- a/commands/random/number-fact.js
+++ b/commands/random/number-fact.js
@@ -20,10 +20,10 @@ module.exports = class NumberFactCommand extends Command {
async run(msg, { number }) {
try {
- const { text } = await snekfetch.get(`http://numbersapi.com/${number}`);
- return msg.say(text);
+ const { raw } = await snekfetch.get(`http://numbersapi.com/${number}`);
+ return msg.say(raw.toString());
} catch (err) {
- if (err.status === 404) return msg.say('Could not find any results.');
+ if (err.statusCode === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/random/reddit.js b/commands/random/reddit.js
index 8bcd2794..5467d6cb 100644
--- a/commands/random/reddit.js
+++ b/commands/random/reddit.js
@@ -37,8 +37,8 @@ module.exports = class RedditCommand extends Command {
⬇ ${post.downs}
`);
} catch (err) {
- if (err.status === 403) return msg.say('This subreddit is private.');
- if (err.status === 404) return msg.say('Could not find any results.');
+ if (err.statusCode === 403) return msg.say('This subreddit is private.');
+ if (err.statusCode === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/search/github.js b/commands/search/github.js
index c40eec53..4d8858ba 100644
--- a/commands/search/github.js
+++ b/commands/search/github.js
@@ -50,7 +50,7 @@ module.exports = class GitHubCommand extends Command {
.addField('❯ Modification Date', new Date(body.updated_at).toDateString(), true);
return msg.embed(embed);
} catch (err) {
- if (err.status === 404) return msg.say('Could not find any results.');
+ if (err.statusCode === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/search/google-autofill.js b/commands/search/google-autofill.js
index ce515513..9d04a27e 100644
--- a/commands/search/google-autofill.js
+++ b/commands/search/google-autofill.js
@@ -21,13 +21,13 @@ module.exports = class GoogleAutofillCommand extends Command {
async run(msg, { query }) {
try {
- const { text } = await snekfetch
+ const { raw } = await snekfetch
.get('https://suggestqueries.google.com/complete/search')
.query({
client: 'firefox',
q: query
});
- const data = JSON.parse(text)[1];
+ const data = JSON.parse(raw.toString())[1];
if (!data.length) return msg.say('Could not find any results.');
return msg.say(data.join('\n'));
} catch (err) {
diff --git a/commands/search/gravatar.js b/commands/search/gravatar.js
index f27d8af4..10f51a6c 100644
--- a/commands/search/gravatar.js
+++ b/commands/search/gravatar.js
@@ -33,7 +33,7 @@ module.exports = class GravatarCommand extends Command {
});
return msg.say({ files: [{ attachment: body, name: `${emailHash}.jpg` }] });
} catch (err) {
- if (err.status === 404) return msg.say('Could not find any results.');
+ if (err.statusCode === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/search/itunes.js b/commands/search/itunes.js
index ca95dfcb..b5b31113 100644
--- a/commands/search/itunes.js
+++ b/commands/search/itunes.js
@@ -30,7 +30,7 @@ module.exports = class ITunesCommand extends Command {
async run(msg, { country, query }) {
try {
- const { text } = await snekfetch
+ const { raw } = await snekfetch
.get('https://itunes.apple.com/search')
.query({
term: query,
@@ -40,7 +40,7 @@ module.exports = class ITunesCommand extends Command {
explicit: msg.channel.nsfw ? 'yes' : 'no',
country
});
- const body = JSON.parse(text);
+ const body = JSON.parse(raw.toString());
if (!body.results.length) return msg.say('Could not find any results.');
const data = body.results[0];
const embed = new MessageEmbed()
@@ -55,7 +55,7 @@ module.exports = class ITunesCommand extends Command {
.addField('❯ Genre', data.primaryGenreName, true);
return msg.embed(embed);
} catch (err) {
- if (err.status === 400) {
+ if (err.statusCode === 400) {
return msg.reply('Invalid country code. Refer to .');
}
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
diff --git a/commands/search/my-anime-list-anime.js b/commands/search/my-anime-list-anime.js
index dbd2b8df..20afe48c 100644
--- a/commands/search/my-anime-list-anime.js
+++ b/commands/search/my-anime-list-anime.js
@@ -28,11 +28,11 @@ module.exports = class MyAnimeListAnimeCommand extends Command {
async run(msg, { query }) {
try {
- const { text } = await snekfetch
+ const { raw } = await snekfetch
.get('https://myanimelist.net/api/anime/search.xml')
.query({ q: query })
.set({ Authorization: `Basic ${base64(`${MAL_USERNAME}:${MAL_PASSWORD}`)}` });
- const body = await xml(text);
+ const body = await xml(raw.toString());
const data = body.anime.entry[0];
const embed = new MessageEmbed()
.setColor(0x2D54A2)
diff --git a/commands/search/my-anime-list-manga.js b/commands/search/my-anime-list-manga.js
index 4f0ecf57..8764d645 100644
--- a/commands/search/my-anime-list-manga.js
+++ b/commands/search/my-anime-list-manga.js
@@ -28,11 +28,11 @@ module.exports = class MyAnimeListMangaCommand extends Command {
async run(msg, { query }) {
try {
- const { text } = await snekfetch
+ const { raw } = await snekfetch
.get('https://myanimelist.net/api/manga/search.xml')
.query({ q: query })
.set({ Authorization: `Basic ${base64(`${MAL_USERNAME}:${MAL_PASSWORD}`)}` });
- const body = await xml(text);
+ const body = await xml(raw.toString());
const data = body.manga.entry[0];
const embed = new MessageEmbed()
.setColor(0x2D54A2)
diff --git a/commands/search/neopet.js b/commands/search/neopet.js
index 64b31818..0040197c 100644
--- a/commands/search/neopet.js
+++ b/commands/search/neopet.js
@@ -40,14 +40,14 @@ module.exports = class NeopetCommand extends Command {
async run(msg, { pet, mood }) {
try {
- const { text } = await snekfetch
+ const { raw } = await snekfetch
.get('http://www.sunnyneo.com/petimagefinder.php')
.query({
name: pet,
size: 5,
mood: moods[mood]
});
- const link = text.match(/http:\/\/pets\.neopets\.com\/cp\/.+\.png/);
+ const link = raw.toString().match(/http:\/\/pets\.neopets\.com\/cp\/.+\.png/);
if (!link) return msg.say('Could not find any results.');
return msg.say(link[0]);
} catch (err) {
diff --git a/commands/search/neopets-item.js b/commands/search/neopets-item.js
index 41aecf28..6c530eab 100644
--- a/commands/search/neopets-item.js
+++ b/commands/search/neopets-item.js
@@ -40,22 +40,24 @@ module.exports = class NeopetItemCommand extends Command {
}
async fetchItem(query) {
- const { text } = await snekfetch
+ const { raw } = await snekfetch
.get('https://items.jellyneo.net/search/')
.query({
name: query,
name_type: 3
});
+ const text = raw.toString();
const id = text.match(/\/item\/([0-9]+)/);
if (!id) return null;
const price = text.match(/([0-9,]+) (NP|NC)/);
const url = `https://items.jellyneo.net/item/${id[1]}/`;
const details = await snekfetch.get(url);
+ const detailsText = details.raw.toString();
return {
id: id[1],
url,
- name: details.text.match(/(.+)<\/h1>/)[1],
- details: details.text.match(/(.+)<\/em>/)[1],
+ name: detailsText.match(/(.+)<\/h1>/)[1],
+ details: detailsText.match(/(.+)<\/em>/)[1],
image: `https://items.jellyneo.net/assets/imgs/items/${id[1]}.gif`,
price: price ? Number.parseInt(price[1].replace(/,/g, ''), 10) : null,
currency: price ? price[2] : null
diff --git a/commands/search/npm.js b/commands/search/npm.js
index ef201519..e721f626 100644
--- a/commands/search/npm.js
+++ b/commands/search/npm.js
@@ -47,7 +47,7 @@ module.exports = class NPMCommand extends Command {
.addField('❯ Maintainers', maintainers.join(', '));
return msg.embed(embed);
} catch (err) {
- if (err.status === 404) return msg.say('Could not find any results.');
+ if (err.statusCode === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/search/pokedex.js b/commands/search/pokedex.js
index 31d714d8..297030f0 100644
--- a/commands/search/pokedex.js
+++ b/commands/search/pokedex.js
@@ -41,7 +41,7 @@ module.exports = class PokedexCommand extends Command {
.setThumbnail(`https://www.serebii.net/sunmoon/pokemon/${id}.png`);
return msg.embed(embed);
} catch (err) {
- if (err.status === 404) return msg.say('Could not find any results.');
+ if (err.statusCode === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/search/recipe.js b/commands/search/recipe.js
index 774bbe42..09d4f393 100644
--- a/commands/search/recipe.js
+++ b/commands/search/recipe.js
@@ -23,10 +23,10 @@ module.exports = class RecipeCommand extends Command {
async run(msg, { query }) {
try {
- const { text } = await snekfetch
+ const { raw } = await snekfetch
.get('http://www.recipepuppy.com/api/')
.query({ q: query });
- const body = JSON.parse(text);
+ const body = JSON.parse(raw.toString());
if (!body.results.length) return msg.say('Could not find any results.');
const recipe = body.results[Math.floor(Math.random() * body.results.length)];
const embed = new MessageEmbed()
@@ -38,7 +38,7 @@ module.exports = class RecipeCommand extends Command {
.setThumbnail(recipe.thumbnail);
return msg.embed(embed);
} catch (err) {
- if (err.status === 500) return msg.say('Could not find any results.');
+ if (err.statusCode === 500) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/search/rotten-tomatoes.js b/commands/search/rotten-tomatoes.js
index 0070a699..497c9775 100644
--- a/commands/search/rotten-tomatoes.js
+++ b/commands/search/rotten-tomatoes.js
@@ -33,8 +33,8 @@ module.exports = class RottenTomatoesCommand extends Command {
if (!search.body.movies.length) return msg.say('Could not find any results.');
const find = search.body.movies.find(m => m.name.toLowerCase() === query.toLowerCase()) || search.body.movies[0];
const urlID = find.url.replace('/m/', '');
- const { text } = await snekfetch.get(`https://www.rottentomatoes.com/api/private/v1.0/movies/${urlID}`);
- const body = JSON.parse(text);
+ const { raw } = await snekfetch.get(`https://www.rottentomatoes.com/api/private/v1.0/movies/${urlID}`);
+ const body = JSON.parse(raw.toString());
const criticScore = body.ratingSummary.allCritics;
const audienceScore = body.ratingSummary.audience;
const embed = new MessageEmbed()
diff --git a/commands/search/rule34.js b/commands/search/rule34.js
index b8266079..19904c02 100644
--- a/commands/search/rule34.js
+++ b/commands/search/rule34.js
@@ -23,7 +23,7 @@ module.exports = class Rule34Command extends Command {
async run(msg, { query }) {
try {
- const { text } = await snekfetch
+ const { raw } = await snekfetch
.get('https://rule34.xxx/index.php')
.query({
page: 'dapi',
@@ -33,6 +33,7 @@ module.exports = class Rule34Command extends Command {
tags: query,
limit: 200
});
+ const text = raw.toString();
if (!text) return msg.say('Could not find any results.');
const body = JSON.parse(text);
const data = body[Math.floor(Math.random() * body.length)];
diff --git a/commands/search/safebooru.js b/commands/search/safebooru.js
index 250f014d..a2904f69 100644
--- a/commands/search/safebooru.js
+++ b/commands/search/safebooru.js
@@ -22,7 +22,7 @@ module.exports = class SafebooruCommand extends Command {
async run(msg, { query }) {
try {
- const { text } = await snekfetch
+ const { raw } = await snekfetch
.get('https://safebooru.org/index.php')
.query({
page: 'dapi',
@@ -32,6 +32,7 @@ module.exports = class SafebooruCommand extends Command {
tags: query,
limit: 200
});
+ const text = raw.toString();
if (!text) return msg.say('Could not find any results.');
const body = JSON.parse(text);
const data = body[Math.floor(Math.random() * body.length)];
diff --git a/commands/search/tumblr.js b/commands/search/tumblr.js
index a28ac62c..52910f15 100644
--- a/commands/search/tumblr.js
+++ b/commands/search/tumblr.js
@@ -39,7 +39,7 @@ module.exports = class TumblrCommand extends Command {
.addField('❯ A.M.A.?', data.ask ? 'Yes' : 'No', true);
return msg.embed(embed);
} catch (err) {
- if (err.status === 404) return msg.say('Could not find any results.');
+ if (err.statusCode === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/search/twitter.js b/commands/search/twitter.js
index 9a03a7f8..37bacaae 100644
--- a/commands/search/twitter.js
+++ b/commands/search/twitter.js
@@ -48,8 +48,8 @@ module.exports = class TwitterCommand extends Command {
.addField('❯ Latest Tweet', body.status ? body.status.text : '???');
return msg.embed(embed);
} catch (err) {
- if (err.status === 401) await this.fetchToken();
- if (err.status === 404) return msg.say('Could not find any results.');
+ if (err.statusCode === 401) await this.fetchToken();
+ if (err.statusCode === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
diff --git a/commands/search/yu-gi-oh.js b/commands/search/yu-gi-oh.js
index 4baf3d69..67d458e5 100644
--- a/commands/search/yu-gi-oh.js
+++ b/commands/search/yu-gi-oh.js
@@ -25,10 +25,10 @@ module.exports = class YuGiOhCommand extends Command {
async run(msg, { card }) {
try {
- const { text } = await snekfetch
+ const { raw } = await snekfetch
.get('https://www.ygohub.com/api/card_info')
.query({ name: card });
- const body = JSON.parse(text);
+ const body = JSON.parse(raw.toString());
if (body.status === 'error') return msg.say('Could not find any results.');
const data = body.card;
const embed = new MessageEmbed()
diff --git a/package.json b/package.json
index 217935f9..177ef389 100644
--- a/package.json
+++ b/package.json
@@ -43,7 +43,7 @@
"pg-hstore": "^2.3.2",
"random-js": "^1.0.8",
"sequelize": "^4.37.6",
- "snekfetch": "^3.6.4",
+ "snekfetch": "^4.0.0",
"uws": "^9.148.0",
"xml2js": "^0.4.19",
"zlib-sync": "^0.1.4"