Discord.py on_member_join 没有响应 [英] Discord.py on_member_join not responding
本文介绍了Discord.py on_member_join 没有响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为我的 on_member_join
事件使用 @client.event
函数.我希望它在用户加入时发送消息,但是,控制台没有响应或错误.
I am using a @client.event
function for my on_member_join
event. I would like it to send a message upon a user joining, however, there are no responses nor errors from the console.
这是我当前尝试的代码
@client.event
async def on_member_join(member):
await member.send(
"<a:welcome1:805857483473027122><a:welcome2:805857477375164468>
<a:tysm:805858522578812930>"
)
推荐答案
与成员相关的事件或 on_member_join
事件,需要在开发者门户中启用特殊的成员意图以及在你的代码.
Events related to members or on_member_join
event, will require the special member intents to be enabled in the developer portal as well as defined in your code.
在门户的 bot
部分启用意图后,将其复制到您的代码中以使用特殊的 member_intents
模块
After enabling the intents in the bot
section of the portal, copy this into your code to use the special member_intents
module
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix='Prefix', intents=intents)
这篇关于Discord.py on_member_join 没有响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文