admin管理员组文章数量:1400045
When I try and run membermanager.fetch();
(documentation), I get the error Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.
I have quite a good internet connection and I've tried giving it more time. This happens both on my test server with about 10 members and the server its intended for with about 30. membermanager.cache
doesn't suffice for my use case. It's not a temporary problem as this was also happening yesterday. My discord.js version is 12.4.1
and I updated it this morning. If it helps the bot is written in typescript.
I've noticed it works if I pass the query
parameter as a non-empty string or user
as an array of user ids, but I assume the discord.js source code is calling a different method entirely.
This has properly left me stumped. If you could help that would be much appreciated.
When I try and run membermanager.fetch();
(documentation), I get the error Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.
I have quite a good internet connection and I've tried giving it more time. This happens both on my test server with about 10 members and the server its intended for with about 30. membermanager.cache
doesn't suffice for my use case. It's not a temporary problem as this was also happening yesterday. My discord.js version is 12.4.1
and I updated it this morning. If it helps the bot is written in typescript.
I've noticed it works if I pass the query
parameter as a non-empty string or user
as an array of user ids, but I assume the discord.js source code is calling a different method entirely.
This has properly left me stumped. If you could help that would be much appreciated.
Share Improve this question asked Oct 27, 2020 at 15:38 radiishradiish 2182 silver badges9 bronze badges 6- What exactly are you trying to do? – user14023978 Commented Oct 27, 2020 at 15:40
-
Do you have the
GUILD_MEMBERS
intent enabled? – Lioness100 Commented Oct 27, 2020 at 15:45 - @Lioness100 how do I enable that? – radiish Commented Oct 27, 2020 at 15:48
- Check my answer to this question – Lioness100 Commented Oct 27, 2020 at 15:49
- @Lioness100 you're a lifesaver! – radiish Commented Oct 27, 2020 at 15:51
1 Answer
Reset to default 8Answering my own question here.
Turns out I didn't have the GUILD_MEMBERS
intent set.
A quick fix from this:
import { Client, Intents } from "discord.js";
export const client: Client = new Client();
to something that included intents:
import { Client, Intents } from "discord.js";
let intents = new Intents(Intents.NON_PRIVILEGED);
intents.add('GUILD_MEMBERS');
export const client: Client = new Client({ ws: {intents: intents} });
and a fix in the discord developer portal. That's all it needed.
本文标签: javascriptwhy does discordjs not let me do guildmembersfetch()Stack Overflow
版权声明:本文标题:javascript - why does discord.js not let me do guild.members.fetch()? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744206811a2595228.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论