PY-Cord Bot上网,但没有回应
我一直在尝试制作一个Discord机器人,但是当我将此代码放置时,机器人在线上转动,但是如果我使用命令,则没有该机器人的响应。
我从他们的github表示
from discord.ext import commands
bot = commands.Bot(command_prefix='!')
@bot.command()
async def test(ctx):
await ctx.send(content="Test")
bot.run('token')
感谢。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用最新的pycord版本(如果我没记错的话,从2.0.0b5开始),他们使用不满的网关版本足够高,您必须启用(特权)消息内容意图在您的应用程序的开发人员网站上都/bot ,但您也可以转到< https://discord.com/developers/developers/applications 然后导航到您的机器人页面)
在您的代码中:
使用此设置,您的机器人将接收带有内容的消息事件,并可以实际处理您的命令,
请注意,一旦您的机器人达到100台服务器,此意图将要求您通过Discord进行白色列出过程。在此之前,您可以自由实现意图测试和构建机器人
With the latest Pycord versions (starting from 2.0.0b5 if I recall correctly), they use a Discord gateway version high enough that you have to enable the (privileged) message content intent both on your application's developer site (

https://discord.com/developers/applications/YOUR_APPLICATION_ID/bot
, but you can also go to https://discord.com/developers/applications and then navigate to your bot page from there)and in your code:
With this setup, your bot will receive message events with the content and can actually process your commands
Note that once your bot reaches 100 servers, this intent will require you to undergo a whitelisting process by Discord. Until then, you can freely enable the intent to test and build your bot