Skip to content
Discussion options

You must be logged in to vote

You can use webhooks to send messages to a specific channel w/o needing any other instrumentation.
The library includes a way to execute webhooks in an async and sync manner which would be useful for your use-case. See a short example:

import discord
import requests

url = 'https://discord.com/api/webhooks/:id/:secret'

session = requests.Session()
webhook = discord.webhook.SyncWebhook.from_url(url, session=session)

webhook.send('Example Content')

You can create a webhook by going into a channel's settings into the integrations tab, and then copying the url for use in your code.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by trypsynth
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants