-1

I have a discord bot that sends images to users when they use the !img command, I don't want people to request an image and then have it sit there until someone deletes it. Is there any way I can make it delete images after 10 seconds or so without using any blocking functions such as time.sleep() in python?

Thanks

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Spell ICUP
  • 45
  • 1
  • 6

1 Answers1

1

Messageable.send has a delete_after kwarg that takes the amount of seconds to delete the sent message after, for example

await channel.send("this message will be deleted after 10 seconds", delete_after=10)

https://discordpy.readthedocs.io/en/neo-docs/api.html#discord.abc.Messageable.send

Zomatree
  • 333
  • 2
  • 8