本文介绍了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并删除不起作用.如何使其运作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 03:10