From f54d051324e52bcc86438350277af7eee5d8986f Mon Sep 17 00:00:00 2001 From: dragonfire535 Date: Tue, 7 Mar 2017 17:59:37 -0500 Subject: [PATCH] Meme Command Added --- commands/imageedit/meme.js | 45 ++++++++++++++ commands/imageedit/memecodes.json | 99 +++++++++++++++++++++++++++++++ index.js | 1 + 3 files changed, 145 insertions(+) create mode 100644 commands/imageedit/meme.js create mode 100644 commands/imageedit/memecodes.json diff --git a/commands/imageedit/meme.js b/commands/imageedit/meme.js new file mode 100644 index 00000000..15719d47 --- /dev/null +++ b/commands/imageedit/meme.js @@ -0,0 +1,45 @@ +const commando = require('discord.js-commando'); +const memecodes = require('./memecodes.json'); + +class MemeCommand extends commando.Command { + constructor(Client){ + super(Client, { + name: 'meme', + group: 'imageedit', + memberName: 'meme', + description: "Sends a Meme with text of your choice, and a background of your choice. Split first and second lines with a | (;meme facepalm I can't even | comprehend this)", + examples: [';cat'] + }); + } + + async run(message, args) { + if(message.channel.type !== 'dm') { + if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return; + if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return; + if(!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES')) return; + } + console.log("[Command] " + message.content); + let [type] = message.content.toLowerCase().split(" ").slice(1); + if(type === "list") { + message.channel.sendMessage("**Type Codes:** tenguy, afraid, older, aag, tried, biw, blb, kermit, bd, ch, cbg, wonka, cb, keanu, dsm, live, ants, doge, alwaysonbeat, ermg, facepalm, fwp, fa, fbf, fry, hipster, icanhas, crazypills, mw, noidea, regret, boat, hagrid, sohappy, captain, inigo, iw, ackbar, happening, joker, ive, ll, morpheus, mb, badchoice, mmm, jetpack, 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, sohot, nice, awesome-awkward, awesome, awkward-awesome, awkward, fetch, success, scc, ski, officespace, interesting, toohigh, bs, center, both, winter, xy, buzz, yodawg, uno, yallgot, bad, elf, chosen"); + } else if(message.content.includes("|")) { + let bottomrow = message.content.toLowerCase().split("|").slice(1).join("-"); + let toprow = " " + message.content.toLowerCase().replace(bottomrow, "").split(" ").slice(2).join("-"); + toprow = toprow.replace("|", ""); + let link = "https://memegen.link/" + type + "/" + toprow + "/" + bottomrow + ".jpg"; + if(type !== "") { + if(memecodes.memecodes[type]) { + message.channel.sendFile(link); + } else { + message.channel.sendMessage(":x: Error! Meme type not found!"); + } + } else { + message.channel.sendMessage(":x: Error! No meme type set! (View list with ;meme list)"); + } + } else { + message.channel.sendMessage(":x: Split your two choices with a ' | '!"); + } + } +} + +module.exports = MemeCommand; \ No newline at end of file diff --git a/commands/imageedit/memecodes.json b/commands/imageedit/memecodes.json new file mode 100644 index 00000000..642905df --- /dev/null +++ b/commands/imageedit/memecodes.json @@ -0,0 +1,99 @@ +{ + "memecodes": { + "tenguy": "tenguy", + "afraid": "afraid", + "older": "older", + "aag": "aag", + "tried": "tried", + "biw": "biw", + "blb": "blb", + "kermit": "kermit", + "bd": "bd", + "ch": "ch", + "cbg": "cbg", + "wonka": "wonka", + "cb": "cb", + "keanu": "keanu", + "dsm": "dsm", + "live": "live", + "ants": "ants", + "doge": "doge", + "alwaysonbeat": "alwaysonbeat", + "ermg": "ermg", + "facepalm": "facepalm", + "fwp": "fwp", + "fa": "fa", + "fbf": "fbf", + "fry": "fry", + "hipster": "hipster", + "icanhas": "icanhas", + "crazypills": "crazypills", + "mw": "mw", + "noidea": "noidea", + "regret": "regret", + "boat": "boat", + "hagrid": "hagrid", + "sohappy": "sohappy", + "captain": "captain", + "inigo": "inigo", + "iw": "iw", + "ackbar": "ackbar", + "happening": "happening", + "joker": "joker", + "ive": "ive", + "ll": "ll", + "morpheus": "morpheus", + "mb": "mb", + "badchoice": "badchoice", + "mmm": "mmm", + "jetpack": "jetpack", + "red": "red", + "mordor": "mordor", + "oprah": "oprah", + "oag": "oag", + "remembers": "remembers", + "philisoraptor": "philosoraptor", + "jw": "jw", + "patrick": "patrick", + "rollsafe": "rollsafe", + "sad-obama": "sad-obama", + "sad-clinton": "sad-clinton", + "sadfrog": "sadfrog", + "sad-bush": "sad-bush", + "sad-biden": "sad-biden", + "sad-boehner": "sad-boehner", + "saltbae": "saltbae", + "sarcasticbear": "sarcasticbear", + "dwight": "dwight", + "sb": "sb", + "ss": "ss", + "sf": "sf", + "dodgson": "dodgson", + "money": "money", + "sohot": "sohot", + "nice": "nice", + "awesome-awkward": "awesome-awkward", + "awesome": "awesome", + "awkward-awesome": "awkward-awesome", + "awkward": "awkward", + "fetch": "fetch", + "success": "success", + "scc": "scc", + "ski": "ski", + "officespace": "officespace", + "interesting": "interesting", + "toohigh": "toohigh", + "bs": "bs", + "center": "center", + "both": "both", + "winter": "winter", + "xy": "xy", + "buzz": "buzz", + "yodawg": "yodawg", + "uno": "uno", + "yallgot": "yallgot", + "bad": "bad", + "elf": "elf", + "chosen": "chosen" + } +} \ No newline at end of file diff --git a/index.js b/index.js index 635f2dac..70ab6d9a 100644 --- a/index.js +++ b/index.js @@ -23,6 +23,7 @@ client.registry ['response', 'Random Response'], ['avataredit', 'Avatar Manipulation'], ['textedit', 'Text Manipulation'], + ['imageedit', 'Image Manipulation'], ['search', 'Search'], ['random', 'Random/Other'], ['roleplay', 'Roleplay']