mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 14:21:41 +02:00
Clean-up Meme
This commit is contained in:
@@ -46,16 +46,15 @@ module.exports = class MemeCommand extends Command {
|
|||||||
try {
|
try {
|
||||||
const memes = await snekfetch
|
const memes = await snekfetch
|
||||||
.get('https://api.imgflip.com/get_memes');
|
.get('https://api.imgflip.com/get_memes');
|
||||||
const memeList = memes.body.data.memes.map(meme => ({
|
const memeList = memes.body.data.memes;
|
||||||
id: meme.id,
|
|
||||||
name: meme.name.toLowerCase()
|
|
||||||
}));
|
|
||||||
if (type === 'list') return msg.say(list(memeList.map(meme => meme.name), 'or'), { split: { char: ' ' } });
|
if (type === 'list') return msg.say(list(memeList.map(meme => meme.name), 'or'), { split: { char: ' ' } });
|
||||||
if (!memeList.some(meme => meme.name === type)) return msg.say(`Invalid type, please use ${msg.usage('list')}.`);
|
if (!memeList.some(meme => meme.name.toLowerCase() === type)) {
|
||||||
|
return msg.say(`Invalid type, please use ${msg.usage('list')}.`);
|
||||||
|
}
|
||||||
const { body } = await snekfetch
|
const { body } = await snekfetch
|
||||||
.post('https://api.imgflip.com/caption_image')
|
.post('https://api.imgflip.com/caption_image')
|
||||||
.query({
|
.query({
|
||||||
template_id: memeList.find(meme => meme.name === type).id,
|
template_id: memeList.find(meme => meme.name.toLowerCase() === type).id,
|
||||||
username: IMGFLIP_USER,
|
username: IMGFLIP_USER,
|
||||||
password: IMGFLIP_PASS,
|
password: IMGFLIP_PASS,
|
||||||
text0: top,
|
text0: top,
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "44.4.0",
|
"version": "44.4.1",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Shard.js",
|
"main": "Shard.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user