From 2343c4f6937c911fe1e09e1bf1dad9a30b75d991 Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Tue, 7 Sep 2021 10:30:04 -0700 Subject: [PATCH] react to images containing dale with the dale emoji --- app/bot.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/app/bot.py b/app/bot.py index 9333c1b7..f1f5fc84 100755 --- a/app/bot.py +++ b/app/bot.py @@ -39,6 +39,25 @@ def generate_embed(embed_url=None, embed_title=None, embed_description=None, emb return embed +#### a bunch of silly functions that will listen for messages with specific content +@bot.listen('on_message') +async def fix_cdn_url(ctx): + if 'media.discordapp.net' in ctx.content: + await ctx.delete() + await ctx.channel.send(ctx.content.replace('media.discordapp.net', 'cdn.discordapp.com')) + return + +@bot.listen('on_message') +async def react_with_dale(ctx): + if 'dale' in ctx.content: + emoji = discord.utils.get(ctx.guild.emojis, name='dale') + if emoji: + await ctx.add_reaction(emoji) + return + + + + @bot.event async def on_ready(): print(f'{bot.user.name} has connected to Discord!') @@ -47,13 +66,6 @@ async def on_ready(): await bot.get_channel(152921472304676865).send("I have reconnected") -@bot.listen('on_message') -async def on_message(ctx): - if 'media.discordapp.net' in ctx.content: - await ctx.delete() - await ctx.channel.send(ctx.content.replace('media.discordapp.net', 'cdn.discordapp.com')) - return - @bot.command(name='shoo') async def shoo(ctx): if ctx.message.author.id != 144986109804412928: