Is this how I check if a user has boosted?

https://old.discordjs.dev/#/docs/discord.js/main/class/GuildMemberRoleManager?scrollTo=premiumSubscriberRole https://old.discordjs.dev/#/docs/discord.js/main/class/RoleManager?scrollTo=premiumSubscriberRole These two links are from the docs. Im not sure which one I should use to check if a member has boosted. My objective is to remove a role from ALL members in a server other than premium subs. Is there a better way to do this other than just looping through all members to check and remove?? (or perhaps just to even remove without checking?) Currently using [email protected] and node version v20.8.0
Discord.js
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
5 Replies
d.js toolkit
d.js toolkit8mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Squid
Squid8mo ago
You can check if a member is boosting by whether <GuildMember>.premiumSince is a number (is boosting) or is null (is not boosting) Depending on how many members have the role you're trying to remove, it may be easier to just clone it, delete the original, and then add the clone to boosters who had it originally
Devvvvvv
DevvvvvvOP8mo ago
clone the role? damn whats that i wonder if the role id changes if i clone and remove og version
Squid
Squid8mo ago
There's not an actual clone method, you would just create a role with the same name/color/permissions/etc as the original So the id would definitely be different since ids are unique, so if you actually could clone roles, two couldn't exist with the same id
Devvvvvv
DevvvvvvOP7mo ago
huh okay maybe its better if i tell you my use case everytime my bot goes offline and then reboots, i want to remove a specific role from all people from the server and i cannot delete that role because im assigning it to people using a different feature using its id in my code i was hoping to make it efficient enough for a few thousand use case
Want results from more Discord servers?
Add your server