This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
connection.receiver.speaking.on("start", async (userID) => {
if(check(!interaction.member.roles.cache.has(role), userID)) {return;}//
So my bot is to check if someone has a role when they talk. when I run a slash command I am able to get the bot into the VC and run this If statement but I get a few problems.
so what this if statement does, is it checks if someone has a role and if the user is in a small array. if they don't have the role and if they are not in the small array it returns out of the speaking event.
- so the goal for .has(role) is if they !have a role it will send false skipping that check in my function, but has(role) is returning false (making it true and breaking the check) when they have the role
- I believe interaction has to do with the person who made the slash command, not the userID member, can I replace interaction with something else to ensure I get a proper check? I am running my slash command in a separate file like how the discord.js guide does it, so guild is undefined, I don't know if I can import guild or anything like that
so tldr
has(role) returns the wrong boolean (I have !..has(role) because I want false if they have the role)
I don't believe interaction is the proper way to check for user information and other methods like guild... is undefined
Thank you
Subreddit
Post Details
- Posted
- 1 year ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/Discordjs/c...