mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Upgrade Meme Command
This commit is contained in:
@@ -1,107 +0,0 @@
|
||||
[
|
||||
"tenguy",
|
||||
"afraid",
|
||||
"older",
|
||||
"aag",
|
||||
"tried",
|
||||
"biw",
|
||||
"stew",
|
||||
"blb",
|
||||
"kermit",
|
||||
"bd",
|
||||
"ch",
|
||||
"cbg",
|
||||
"wonka",
|
||||
"cb",
|
||||
"keanu",
|
||||
"dsm",
|
||||
"live",
|
||||
"ants",
|
||||
"doge",
|
||||
"alwaysonbeat",
|
||||
"ermg",
|
||||
"facepalm",
|
||||
"firsttry",
|
||||
"fwp",
|
||||
"fa",
|
||||
"fbf",
|
||||
"fry",
|
||||
"ggg",
|
||||
"hipster",
|
||||
"icanhas",
|
||||
"crazypills",
|
||||
"mw",
|
||||
"noidea",
|
||||
"regret",
|
||||
"boat",
|
||||
"hagrid",
|
||||
"sohappy",
|
||||
"captain",
|
||||
"bender",
|
||||
"inigo",
|
||||
"iw",
|
||||
"ackbar",
|
||||
"happening",
|
||||
"joker",
|
||||
"ive",
|
||||
"ll",
|
||||
"away",
|
||||
"morpheus",
|
||||
"mb",
|
||||
"badchoice",
|
||||
"mmm",
|
||||
"jetpack",
|
||||
"imsorry",
|
||||
"red",
|
||||
"mordor",
|
||||
"oprah",
|
||||
"oag",
|
||||
"remembers",
|
||||
"philosoraptor",
|
||||
"jw",
|
||||
"patrick",
|
||||
"rollsafe",
|
||||
"sad-obama",
|
||||
"sad-clinton",
|
||||
"sadfrog",
|
||||
"sad-bush",
|
||||
"sad-biden",
|
||||
"sad-boehner",
|
||||
"saltbae",
|
||||
"sarcasticbear",
|
||||
"dwight",
|
||||
"sb",
|
||||
"ss",
|
||||
"sf",
|
||||
"dodgson",
|
||||
"money",
|
||||
"snek",
|
||||
"sohot",
|
||||
"nice",
|
||||
"awesome-awkward",
|
||||
"awesome",
|
||||
"awkward-awesome",
|
||||
"awkward",
|
||||
"fetch",
|
||||
"success",
|
||||
"scc",
|
||||
"ski",
|
||||
"officespace",
|
||||
"interesting",
|
||||
"toohigh",
|
||||
"bs",
|
||||
"fine",
|
||||
"sparta",
|
||||
"whatyear",
|
||||
"center",
|
||||
"both",
|
||||
"winter",
|
||||
"xy",
|
||||
"buzz",
|
||||
"yodawg",
|
||||
"uno",
|
||||
"yallgot",
|
||||
"bad",
|
||||
"elf",
|
||||
"chosen"
|
||||
]
|
||||
@@ -1,32 +1,27 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { list } = require('../../structures/Util');
|
||||
const codes = require('../../assets/json/meme');
|
||||
|
||||
module.exports = class MemeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'meme',
|
||||
group: 'image-edit',
|
||||
group: 'fun',
|
||||
memberName: 'meme',
|
||||
description: 'Sends a meme with the text and background of your choice.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
details: `**Codes:** ${codes.join(', ')}`,
|
||||
args: [
|
||||
{
|
||||
key: 'type',
|
||||
prompt: `What meme type do you want to use? Either ${list(codes, 'or')}.`,
|
||||
prompt: 'What meme type do you want to use?',
|
||||
type: 'string',
|
||||
validate: type => {
|
||||
if (codes.includes(type.toLowerCase())) return true;
|
||||
return `Invalid meme type, please enter either ${list(codes, 'or')}.`;
|
||||
},
|
||||
parse: type => type.toLowerCase()
|
||||
},
|
||||
{
|
||||
key: 'top',
|
||||
prompt: 'What should the top row of the meme to be?',
|
||||
type: 'string',
|
||||
default: '_',
|
||||
validate: top => {
|
||||
if (top.length < 200) return true;
|
||||
return 'Invalid top text, please keep the top text under 200 characters.';
|
||||
@@ -37,6 +32,7 @@ module.exports = class MemeCommand extends Command {
|
||||
key: 'bottom',
|
||||
prompt: 'What should the bottom row of the meme to be?',
|
||||
type: 'string',
|
||||
default: '_',
|
||||
validate: bottom => {
|
||||
if (bottom.length < 200) return true;
|
||||
return 'Invalid bottom text, please keep the bottom text under 200 characters.';
|
||||
@@ -49,10 +45,17 @@ module.exports = class MemeCommand extends Command {
|
||||
|
||||
async run(msg, { type, top, bottom }) {
|
||||
try {
|
||||
if (type === 'list') {
|
||||
const { body } = await snekfetch
|
||||
.get('https://memegen.link/api/templates/');
|
||||
const codes = Object.values(body).map(code => code.replace('https://memegen.link/api/templates/', ''));
|
||||
return msg.say(list(codes));
|
||||
}
|
||||
const { body } = await snekfetch
|
||||
.get(`https://memegen.link/api/templates/${type}/${top}/${bottom}`, { followRedirects: true });
|
||||
return msg.say(body.direct.masked);
|
||||
return msg.say({ files: [body.direct.masked] });
|
||||
} catch (err) {
|
||||
if (err.status === 404) return msg.say(`Invalid meme type, please use ${msg.usage('list')} for a list.`);
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "40.4.0",
|
||||
"version": "40.4.1",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Shard.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user