diff --git a/Shitpost.py b/Shitpost.py index df3e19d..659f552 100644 --- a/Shitpost.py +++ b/Shitpost.py @@ -93,6 +93,49 @@ class Shitpost(object): except: print("No permission to delete message") yield from ctx.channel.send(ctx.author.mention, embed=em) + + @commands.command(pass_context=True, hidden=True) + @asyncio.coroutine + def tegeltje(self, ctx, tekst: str, auteur: str=" "): + """Maak een mooi tegeltje met volkswijsheid + Bijvoorbeeld: + !tegeltje \"Oost west, 420 best\" \"Lourens\" + """ + + params = { + 'template_id': '121572521', #delfts blauw + 'username': 'Stroopwafel', + 'password': 'ruyter118', + 'text0': 'dummy0', + 'text1': 'dummy1', + 'font': 'arial', + 'max_font_size': 27, + 'boxes[0][text]': tekst, + 'boxes[0][x]': 40, + 'boxes[0][y]': 85, + 'boxes[0][width]': 220, + 'boxes[0][height]': 150, + 'boxes[0][color]': '#0044cc', + 'boxes[0][outline_color]': '#ffffff', + 'boxes[1][text]': auteur, + 'boxes[1][x]': 80, + 'boxes[1][y]': 245, + 'boxes[1][width]': 140, + 'boxes[1][height]': 12, + 'boxes[1][color]': '#0044cc', + 'boxes[1][outline_color]': '#ffffff' + } + + resp = requests.get(url='https://api.imgflip.com/caption_image', params=params) + #todo check for success + photourl = resp.json()['data']['url'] + em = discord.Embed(title='Tegeltjeswijsheid:', type='photo') + em.set_image(url=photourl) + try: + yield from ctx.message.delete() + except: + print("No permission to delete message") + yield from ctx.channel.send(ctx.author.mention, embed=em) @commands.command(pass_context=True) @asyncio.coroutine