How would I send a message from another thread? #5868
Unanswered
Daanish-Khan
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Please see the background task example for how to do this, alternatively if you need this to be wrapped in a prettier interface there's the |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've got a bot that sends live updates to a channel. I've created a listener to obtain data, which is then processed and sent into it's respective discord channel. However, I am unable to send messages as it needs async, and creating a thread with async isn't working.
Asyncio has also proven to be difficult. I've tried asyncio.run_coroutine_threadsafe, which for some reason prevents the bot from processing commands. Creating a new event loop gives me
Timeout context manager should be used inside a task.
Any ideas?
This is code below that is similar to what I have at the moment.
Beta Was this translation helpful? Give feedback.
All reactions