dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
680 stars 162 forks source link

wait_for message_edit not working #126

Closed Mehul343 closed 2 years ago

Mehul343 commented 2 years ago

Summary

wait_for message_edit isn't doing anything

Reproduction Steps

Run the code send the command followed by a message "hi" then edit that message. wait_for message works but wait_for message_edit doesn't.

Code

from selfcord.ext import commands
import asyncio

bot = commands.Bot(command_prefix=';', self_bot=True)

def check(m):
      return m.author.id == userid and m.channel.id == channelid

@bot.command()
async def hi(ctx):
      if ctx.channel.id == channelid and ctx.author.id == userid:
            try:
                  try:        
                        msg = await bot.wait_for("message", check=check, timeout=10)

                  except:
                        pass

                  else:
                        print("worked 1")
                        if "hi" in msg.content:
                         try:
                              edited_msg = await bot.wait_for('message_edit', check=check, timeout=20)

                         except asyncio.TimeoutError:
                              print("Timeout")

                         else:
                              print("Worked 2")

            except:
                  pass

bot.run(token)

Expected Results

It should print worked 1 then worked 2.

Actual Results

It prints worked 1 but not worked 2 or timeout which means wait_for message_edit isn't doing anything.

System Information

Checklist

Additional Information

No response

dolfies commented 2 years ago

First of all, you're on an old version of the library.

Mehul343 commented 2 years ago

First of all, you're on an old version of the library.

I figured it out myself checks for message_edit requires 2 arguments.