#Bot interact with webhook

1 messages · Page 1 of 1 (latest)

hidden trout
#
    async with aiohttp.ClientSession() as session:
      webhook = Webhook.from_url('REMOVED TO PREVENT SPAM', session=session)
      await webhook.send(f"<@&1034932304402976879> \n {announcement}", username='Announcements')```
weak forge
#

When you use a with block, as soon as you exit it the sessions will close

#

so indent it

hidden trout
#

yep

weak forge
#

Yes, since you're using the webhook in that await, it needs to be inside the with aiohttp

dark lanternBOT
#
Solved!

Marked the thread as solved. If your question has not been answered, please open a new thread in #1019642966526140566.