mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 14:21:41 +02:00
Node 15
This commit is contained in:
@@ -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!`);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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.')
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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(' ', '-'))
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -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}>`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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!`);
|
||||
|
||||
Reference in New Issue
Block a user