-2

How can I send a later on changing message?

I tried something like this:

message = bot.get_channel(id).send("deleting in 5s")
time.sleep(5)
message.delete()

But it gives me this error:

AttributeError: 'coroutine' object has no attribute 'edit'

How can I make this work?

Pilonyen
  • 39
  • 6
  • Where is the `edit` part in the code though? Also: `time.sleep()` is outdated and should not be used anymore, use `asyncio.sleep()` instead. – Dominik Aug 13 '22 at 10:01
  • pycord != discord.py. Please remove one of the two tags. – puncher Aug 13 '22 at 10:37
  • Please include the full traceback of the error and the part of the code where it happens (it should give you some line numbers). – Eric Jin Aug 13 '22 at 13:13

1 Answers1

-1

send, delete and edit are async functions, remember to use await when calling them.

channel = bot.get_channel(id)
message = await channel.send("deleting in 5s")
time.sleep(5)
await message.delete()
Parasol Kirby
  • 351
  • 1
  • 11