This commit is contained in:
Dragon Fire
2020-10-24 14:25:32 -04:00
parent 40080cadef
commit ebd26a7b0e
25 changed files with 42 additions and 44 deletions
+2 -2
View File
@@ -51,8 +51,8 @@ module.exports = class BulbapediaCommand extends Command {
.setTitle(data.title)
.setAuthor('Bulbapedia', 'https://i.imgur.com/ePpoeFA.png', 'https://bulbapedia.bulbagarden.net/')
.setThumbnail(data.thumbnail ? data.thumbnail.source : null)
.setURL(`https://bulbapedia.bulbagarden.net/wiki/${encodeURIComponent(query).replace(/\)/g, '%29')}`)
.setDescription(shorten(data.extract.replace(/\n/g, '\n\n')));
.setURL(`https://bulbapedia.bulbagarden.net/wiki/${encodeURIComponent(query).replaceAll(')', '%29')}`)
.setDescription(shorten(data.extract.replaceAll('\n', '\n\n')));
return msg.embed(embed);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
+1 -1
View File
@@ -53,7 +53,7 @@ module.exports = class LyricsCommand extends Command {
const { text } = await request.get(`https://www.azlyrics.com/lyrics/${artist}/${song}.html`);
const lyrics = text.match(lyricRegex)[1];
return lyrics
.replace(/<br>/g, '')
.replaceAll('<br>', '')
.replace(/<\/?div>/g, '')
.trim();
}
+1 -1
View File
@@ -22,7 +22,7 @@ module.exports = class MDNCommand extends Command {
key: 'query',
prompt: 'What article would you like to search for?',
type: 'string',
parse: query => query.replace(/#/g, '.prototype.')
parse: query => query.replaceAll('#', '.prototype.')
}
]
});
+1 -1
View File
@@ -70,7 +70,7 @@ module.exports = class NeopetsItemCommand extends Command {
name: details.match(/<h1>(.+)<\/h1>/)[1],
details: details.match(/<em>(.+)<\/em>/)[1],
image: `https://items.jellyneo.net/assets/imgs/items/${id[1]}.gif`,
price: price ? Number.parseInt(price[1].replace(/,/g, ''), 10) : null,
price: price ? Number.parseInt(price[1].replaceAll(',', ''), 10) : null,
currency: price ? price[2] : null
};
}
+1 -1
View File
@@ -25,7 +25,7 @@ module.exports = class NPMCommand extends Command {
label: 'package',
prompt: 'What package would you like to get information on?',
type: 'string',
parse: pkg => encodeURIComponent(pkg.replace(/ /g, '-'))
parse: pkg => encodeURIComponent(pkg.replaceAll(' ', '-'))
}
]
});
+1 -1
View File
@@ -102,6 +102,6 @@ module.exports = class PaladinsCommand extends Command {
case 'Damage': emojiID = DAMAGE_EMOJI_ID; break;
case 'Front Line': emojiID = FRONT_LINE_EMOJI_ID; break;
}
return `<:${className.replace(/ /g, '')}:${emojiID}>`;
return `<:${className.replaceAll(' ', '')}:${emojiID}>`;
}
};
+2 -2
View File
@@ -51,8 +51,8 @@ module.exports = class WikipediaCommand extends Command {
.setTitle(data.title)
.setAuthor('Wikipedia', 'https://i.imgur.com/Z7NJBK2.png', 'https://www.wikipedia.org/')
.setThumbnail(data.thumbnail ? data.thumbnail.source : null)
.setURL(`https://en.wikipedia.org/wiki/${encodeURIComponent(query).replace(/\)/g, '%29')}`)
.setDescription(shorten(data.extract.replace(/\n/g, '\n\n')));
.setURL(`https://en.wikipedia.org/wiki/${encodeURIComponent(query).replaceAll(')', '%29')}`)
.setDescription(shorten(data.extract.replaceAll('\n', '\n\n')));
return msg.embed(embed);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);