Answer the question
In order to leave comments, you need to log in
Discord.py how to make a bot so that I can send messages to a specific channel?
Is it possible to do something so that I can send messages from the console to the discord on behalf of the bot. Or rather, is it possible to somehow
display msg as a message from the bot?
If there are other ways, please explain in detail.
Thanks in advance!
msg = input('Ваше сообщение')
Answer the question
In order to leave comments, you need to log in
discord.py is an asynchronous framework. You can’t just make synchronous code in it that waits for something. To read stdin, you need to work with it correctly through asyncio.
There are many examples on the Internet, and I also found such a module: https://github.com/vxgmichel/aioconsole
Hey, send a message to a specific channel, it's easy))
and of course you need to read the documentation))
code example:
@Client.event
async def on_ready():
while True:
try:
channel = await Client.fetch_channel(input("id Канала: "))
await channel.send(content=input("Ваше сообщение: ")
except Exception:
print("Не хватает прав")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question