本文介绍了on_member_join 和删除不起作用.如何让它发挥作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我不知道为什么,但这两个命令对我不起作用.

I don't know why but those 2 commands don't work for me.

@client.event
async def on_member_join(member):
    ver_Channel = client.get_channel(799666119787020289)
    await ver_Channel.send(member+ " have joined the server!")


@client.event
async def on_member_remove(member):
    ver_Channel = client.get_channel(799666119787020289)
    await ver_Channel.send(member + " have been left :(")

顺便说一句,请写下基本的编码说明我是初学者

btw please write in basic coding explanation I'm a beginner

推荐答案

我很确定这是一个意图问题,你应该启用 intents.members

I'm pretty sure this is an intents issue, you should enable intents.members

intents = discord.Intents.default() # Enabling everything apart from privileged intents (members & presences)
intents.members = True # Explicitly enabling `intents.members`

client = commands.Bot(..., intents=intents)

还要确保在开发者门户

如何启用特权网关意图

这篇关于on_member_join 和删除不起作用.如何让它发挥作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-09 02:51