-
I need to run a script on a schedule that will print a few messages to a specific channel. Is there a way to do this without getting into an event loop and having to exit the program with exit(), quit(), etc when done? |
Beta Was this translation helpful? Give feedback.
Answered by
Rapptz
Oct 6, 2020
Replies: 1 comment 1 reply
-
You should probably use a webhook. The library supports webhooks in both async ( from discord import Webhook, RequestsWebhookAdapter
webhook_url = 'your webhook URL goes here'
webhook = Webhook.from_url(webhook_url, adapter=RequestsWebhookAdapter())
# Send a message to the channel
webhook.send('Hello world!') |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should probably use a webhook.
The library supports webhooks in both async (
aiohttp
) and sync (requests
) mode so once you get your webhook URL you can use therequests
library and post to it. For example: