discord.py Reply to a specific message which user replied to

  discord.py, python

So basically, my bot sends a picture as a reaction (the wheeze meme) and deletes the message of the user.
What I want to do is, that if the user sent the command as a reply, the bot should also reply to that specific message.

Is it possible to modify the following command to respond to a specific message with it’s id?

    async def wheeze(ctx):
    name = ctx.message.author.display_name
    await ctx.message.delete()
    if ctx.reference is not None and not ctx.is_system :
       messageid = await ctx.channel.fetch_message(ctx.message.reference.message_id)
       await ctx.reply(name + " wheezed", file = discord.File('wheeze.jpg')) #reply to a specific message with its id
    else:
       await ctx.send(name + " wheezed", file = discord.File('wheeze.jpg'))

I got the
messageid = await ctx.channel.fetch_message(ctx.message.reference.message_id) from another stackoverflow post, so I don’t really know whether it works or not.

Source: Python Questions

LEAVE A COMMENT