some array problems. #9189
-
Which package is this bug report for?discord.js Issue descriptionHi, I do not know if I have made a discord.js error or something caused by me recently. Although he was string, he did not give the role without Array. Code sampleconst unRegRole = "901530734991384646",
module.exports = {
conf: {
cmd: "rolsuz",
aliases: ["rolsüz"],
enabled: true,
cmdPerms: ["cmdOwner"]
},
run: async (client, message, args) => {
let rolsuz = message.guild.members.cache.filter(a => a.roles.cache.size <= 1)
if (rolsuz.size == 0) return message.channel.send(`\`\`\`Sunucumuzda rolsüz üye bulunmamakta.\`\`\``)
await rolsuz.forEach(member => {
member.roles.add([unRegRole]).catch(() => { })
});
await message.channel.send(`\`\`\`Herhangi bir rolü olmayan ${rolsuz.size} kişiye kayıtsız rolü verildi.\`\`\``)
}
}; Package version14.5.0 Node.js versionv18.14.0 Operating systemWindows 11 Priority this issue should haveHigh (immediate attention needed) Which partials do you have configured?User, Channel, GuildMember, Message, Reaction, GuildScheduledEvent, ThreadMember Which gateway intents are you subscribing to?Guilds, GuildMembers, GuildModeration, GuildEmojisAndStickers, GuildIntegrations, GuildWebhooks, GuildInvites, GuildVoiceStates, GuildPresences, GuildMessages, GuildMessageReactions, GuildMessageTyping, DirectMessages, DirectMessageReactions, DirectMessageTyping, MessageContent, GuildScheduledEvents, AutoModerationConfiguration, AutoModerationExecution I have tested this issue on a development releaseNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Not all members are cached, so that it doesn't add roles sometimes. It's better to implement that feature in the |
Beta Was this translation helpful? Give feedback.
-
If the cache doesn't provide most members in the cache, try fetching them. |
Beta Was this translation helpful? Give feedback.
If the cache doesn't provide most members in the cache, try fetching them.