#Getting error while using asyncio.sleep(15*60) to send multiple messages at intervals

1 messages · Page 1 of 1 (latest)

willow falcon
#

I'm using asyncio.sleep() to send multiple messages at an interval of 15 minutes,

I'm implementing it like this

for file in files:
  inter.followup_send(file=Disnake.file(fp, name))
  asyncio.sleep(15*60)

The first message goes well, but after the interval it stops and throws this error

disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 401 Unauthorized (error code: 50027): Invalid Webhook Token

spice cave
#

yes, you can use the followup for 15 minutes after the interaction was created

#

also you should use tasks

zenith briarBOT
#

class disnake.ext.tasks.Loop```
A background task helper that abstracts the loop and reconnection logic for you.

The main interface to create this is through [`loop()`](https://docs.disnake.dev/en/stable/ext/tasks/index.html#disnake.ext.tasks.loop "disnake.ext.tasks.loop").
willow falcon
spice cave
#

yes

willow falcon
#

Thanks will check out loops 🙂