Sending a message in a discord channel without events using PYTHON and DISCORD.PY leave running the other part of the code

Viewed 23

I'm wondering on how to send a message in a specific channel using PYTHON and DISCORD.PY library. I'm just a little bit confused. I wrote a piece of code running correctly under python-binance library and sending messages via telegram library without any issues. The messages are sent when some conditions are met in the code without any telegram events, so the code is not locked in any point of the program. I need to achieve the same target but using discord instead. I'm not able to do so because I cannot find any example of this type. Could someone lights up an idea or a piece of code for me? Thanks to all.

1 Answers
# You can get the channel ID by enabling developer mode
# and right-clicking on the channel and clicking "Copy ID"
channel = client.get_channel(12324234183172)
# Normally you would await, but since you want to leave your code running
channel.send('Here is your message')
Related