在message.guild.get_member_named("member_name")中不获取任何内容 [英] Getting None in message.guild.get_member_named("member_name")

查看:32
本文介绍了在message.guild.get_member_named("member_name")中不获取任何内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在
message.guild.get_member_named("Testing Account")中得到NoneType
并且在不和谐服务器中有一个名为测试帐户"的人/帐户.

I'm getting NoneType in
message.guild.get_member_named("Testing Account")
and there is a person/account named Testing Account in the discord server.

推荐答案

首先,请确保您的漫游器已在

First, make sure your bot has members intent enabled in the developer portal

在代码中启用意图,并​​使用 intents kwarg将其传递到您的bot/客户端中.

Enable intents in the code, and pass them in your bot/client with the intents kwarg.

intents = discord.Intents.default()
intents.members = True

client = commands.Bot(command_prefix='!', intents=intents)

如果您设置机器人的方式与我的方式不同,我将更新问题.

I will update the question if the way you setup your bot is different than mine.

如果您的漫游器跟踪在场数据,则可能需要在场意图以接收在场事件数据."-Discord开发人员门户网站

"If your bot tracks presence data, you may need the presence intent to receive presence event data." - Discord Developer Portal

这篇关于在message.guild.get_member_named("member_name")中不获取任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆