async def generatememe(ctx, top: str, bottom: str): await client.send_typing(ctx.message.channel) api = pyimgflip.Imgflip(username='******', password='******') memes = api.get_memes() meme = random.choice(memes) print("Generating a meme from template: " + meme.name) result = api.caption_image(meme, top, bottom) # embed = discord.Embed(title="Your Choice:", description=rpss, color=0xe91e63) await client.say("Meme available at URL: " + result['url'])
async def memeit(self, ctx, args1, args2): 'MEME IT! memeit [text1] [text2]' api = pyimgflip.Imgflip(username='******', password='******') memes = api.get_memes() meme = random.choice(memes) if args1 == None and args2 == None: result = api.caption_image(meme, "I forget to add", "Captions!") else: result = api.caption_image(meme, "{}".format(args1), "{}".format(args2)) em = discord.Embed() em.set_image(url=result['url']) try: await ctx.send(embed=em) await ctx.message.delete() except: await ctx.send(result['url']) await ctx.message.delete()
async def spongebob_meme(message): args = get_search_args(message) if len(args) != 3: # I'm lazy await bot.send_message(message.channel, '**Usage**: !sponge "<text>"') else: spongified_word = '' capitalize = True for letter in args[1]: if capitalize: spongified_word += letter.upper() else: spongified_word += letter capitalize = not capitalize imgflip = pyimgflip.Imgflip(username=IMGFLIP_USER, password=IMGFLIP_PASS) print("Generating spongebob meme..") result = imgflip.caption_image(102156234, spongified_word, '') print("Meme available at URL: " + result['url']) await bot.send_message(message.channel, result['url'])
async def memeit(self, ctx, args1, args2): 'MEME IT! memeit [text1] [text2]' api = pyimgflip.Imgflip(username='******', password='******') memes = api.get_memes() meme = random.choice(memes) #print("Generating a meme from template: " + meme.name) if args1 == None or args2 == None: result = api.caption_image(meme, "I forget to add", "Captions!") else: result = api.caption_image(meme, "{}".format(args1), "{}".format(args2)) #print("Meme available at URL: " + result['url']) em = discord.Embed() em.set_image(url=result['url']) try: await ctx.send(embed=em) await ctx.message.delete() except: await ctx.send(result['url']) await ctx.message.delete()