You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Restcord API调用listGuildMembers无结果及email返回NULL求助

Troubleshooting Restcord's listGuildMembers Issues

Let's break down your problems and walk through targeted fixes step by step:

1. Empty Results in Stable Restcord Version

You noted that three different calls to listGuildMembers returned empty results in the stable release, but started working after switching to the dev branch. This is almost certainly a bug in the stable version that's already been patched in the development branch. Here's what you can do:

  • Stick with the dev branch temporarily until a stable update rolls out with the fix.
  • Double-check that your bot has the GUILD_MEMBERS privileged intent enabled in the Discord Developer Portal (under your bot's "Privileged Gateway Intents" section) and that your bot token includes the guilds.members.read scope. Missing these permissions can also lead to empty member lists.

Your test calls for reference:

// Attempt 1
$users = $client->guild->listGuildMembers(['guild.id' => 451261315667853312, 'limit' => 25]);
// Attempt 2
$users = $client->guild->listGuildMembers(['guild.id' => 451261315667853312, 'limit' => 25, 'after'=>0]);
// Attempt 3
$users = $client->guild->listGuildMembers(['guild.id' => 451261315667853312, 'limit' => 25, 'after'=>450894467260743690]); // Guild owner ID

2. NULL Email Field in Dev Branch

The email field returning NULL is almost always tied to Discord's API permissions and scopes, not a Restcord issue. For Discord to return a user's email, all these conditions must be satisfied:

  • Your bot must be authorized with the email OAuth2 scope (enable this in your app's OAuth2 settings in the Discord Developer Portal).
  • The user must have explicitly granted your app permission to access their email during the OAuth2 authorization flow—note that just being a member of the guild doesn't automatically grant this access.
  • The user's privacy settings allow their email to be shared with authorized apps.

If you're trying to fetch emails without going through the OAuth2 authorization flow for each user, Discord won't return the email field, even if your bot has the correct intents.

内容的提问来源于stack exchange,提问作者Jafer.balti

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:39:38