discord.py-通过控制台发送消息 [英] discord.py - Send messages though console
本文介绍了discord.py-通过控制台发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好的,我想要这样,我可以在特定的服务器中发送消息,并通过控制台发送消息。我在其他帖子上看到了如何在特定的服务器和频道上发送消息,但是如何从不和谐的应用程序而不是控制台上发送消息。有人可以帮我吗?
ok, I wanted so I could send messages in an specific server and channel form the console. I seen on other post how to send messages on specific servers and channels but theyr from the discord app and not console. Can someone help me?
我想要这样,所以我键入 msg [server-id-here] [channel-name] [message] $例如,c $ c>
I wanted so I type msg [server-id-here] [channel-name] [message]
for example
msg 493121776402825219您好
msg 493121776402825219 general hello
我有代码但有错误
@bot.event
async def on_ready(ch, *, msg):
while msg:
channel = bot.get_channel(ch)
msg=input("Mensagem: ")
if channel:
await bot.send_message(channel, msg)
else:
await bot.say("I can't find that channel")
输出错误
TypeError :on_message()缺少1个必需的位置参数:'ch'
推荐答案
使用say命令。
@bot.command()
async def say(ctx, *,message):
if not ctx.author.bot:
else:
pass
这篇关于discord.py-通过控制台发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文