Jump to content

NodeJS Issue

Stentorian

Hello,

 

So basically I am running into some issues with my code. I am going to put Hastebin links to all of the necessary code (which I think it necessary to my issue) below followed by a full description of what I am trying to do: 

Code:
messageReactionAdd.js (in the events folder) - https://hasteb.in/emizihiv.js
 
I want it so that when the bot is started up, it will send the embed defined in reactions.js in #verification in my Discord server and will react to it with the ticket symbol. After that, it will be constantly watching that message for a reaction to happen. If a reaction occurs (only with that emoji) then the user that reacted is given the Member role. A bit like how the tickets work with the emoji reactions but not creating a channel and instead adding a role.
 
I am not getting any errors when running the code and I have asked a friend who is experienced in Node to help out and he's stuck as well. Any help would be appreciated. 
 
Many Thanks, 
Ben

Current PC: 

Spoiler

Motherboard: MSI Z390-A PRO

CPU: Intel Core i7-9700K @ 3.60GHz

Memory: 32GB (4x8GB) Corsair Vengeance 

Graphics Card: NVIDIA GeForce RTX 3060 Ti

Boot: Crucial P2 500GB (M.2)

SSD: Crucial BX500 1TB

HDD: Seagate ST2000DM001 2TB

HDD: Seagate Barracuda 4TB

PSU: Gigabyte P750GM 750W

Case: IONZ KZ10

Current Laptop:

Spoiler

Name: Lenovo ThinkBook 14 20SL003JUK

CPU: Intel i7-1065G7 @ 3GHz

Graphics: Intel Iris Graphics

RAM: 16GB DDR4 @ 2667MHz

SSD: 480GB Western Digital M.2

Secondary SSD: 240GB Adata SATA

Other Gear:

Spoiler

Phone: Google Pixel 6 (128GB)

Headphones: Steelseries Arctis 3

Microphone: Blue Snowball Ice

Speakers: Creative T100

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, Serjeant said:

I've already put it in an event as the URL says. That's the whole point of the `messageReactionAdd.js`

Current PC: 

Spoiler

Motherboard: MSI Z390-A PRO

CPU: Intel Core i7-9700K @ 3.60GHz

Memory: 32GB (4x8GB) Corsair Vengeance 

Graphics Card: NVIDIA GeForce RTX 3060 Ti

Boot: Crucial P2 500GB (M.2)

SSD: Crucial BX500 1TB

HDD: Seagate ST2000DM001 2TB

HDD: Seagate Barracuda 4TB

PSU: Gigabyte P750GM 750W

Case: IONZ KZ10

Current Laptop:

Spoiler

Name: Lenovo ThinkBook 14 20SL003JUK

CPU: Intel i7-1065G7 @ 3GHz

Graphics: Intel Iris Graphics

RAM: 16GB DDR4 @ 2667MHz

SSD: 480GB Western Digital M.2

Secondary SSD: 240GB Adata SATA

Other Gear:

Spoiler

Phone: Google Pixel 6 (128GB)

Headphones: Steelseries Arctis 3

Microphone: Blue Snowball Ice

Speakers: Creative T100

Link to comment
Share on other sites

Link to post
Share on other sites

Which version of discord.js are using? The documentation I'm reading suggests that you should be checking against `reaction.emoji.name`, and then it should be `if (reaction.emoji.name === 'white_check_mark')`, though I'm not sure if the name property includes the colons or not. Temporarily remove the if statement and log the properties of the emoji object.

Link to comment
Share on other sites

Link to post
Share on other sites

14 hours ago, Serjeant said:

Which version of discord.js are using? The documentation I'm reading suggests that you should be checking against `reaction.emoji.name`, and then it should be `if (reaction.emoji.name === 'white_check_mark')`, though I'm not sure if the name property includes the colons or not. Temporarily remove the if statement and log the properties of the emoji object.

I am using version 11.5.1 of Discord.JS. And for some reason when I ran 

console.log(reaction);

it just gave me all the bot's information. So everything that I had provided as the bot.settings variable (where the token is stored) and all the channels in the guild. Nothing other than that. 

Current PC: 

Spoiler

Motherboard: MSI Z390-A PRO

CPU: Intel Core i7-9700K @ 3.60GHz

Memory: 32GB (4x8GB) Corsair Vengeance 

Graphics Card: NVIDIA GeForce RTX 3060 Ti

Boot: Crucial P2 500GB (M.2)

SSD: Crucial BX500 1TB

HDD: Seagate ST2000DM001 2TB

HDD: Seagate Barracuda 4TB

PSU: Gigabyte P750GM 750W

Case: IONZ KZ10

Current Laptop:

Spoiler

Name: Lenovo ThinkBook 14 20SL003JUK

CPU: Intel i7-1065G7 @ 3GHz

Graphics: Intel Iris Graphics

RAM: 16GB DDR4 @ 2667MHz

SSD: 480GB Western Digital M.2

Secondary SSD: 240GB Adata SATA

Other Gear:

Spoiler

Phone: Google Pixel 6 (128GB)

Headphones: Steelseries Arctis 3

Microphone: Blue Snowball Ice

Speakers: Creative T100

Link to comment
Share on other sites

Link to post
Share on other sites

I was able to get it to work with:

if (reaction.emoji.name == "✅") {
  // do something
}

What exactly isn't working for you? Is the messageReactionAdd event not emitting, or is it failing the condition?

Link to comment
Share on other sites

Link to post
Share on other sites

16 hours ago, Serjeant said:

I was able to get it to work with:


if (reaction.emoji.name == "") {
  // do something
}

What exactly isn't working for you? Is the messageReactionAdd event not emitting, or is it failing the condition?

Well the message is getting sent into the channel and it reacts with the emoji but I don't think it is watching the message for any other reactions. I need it to consistently keep watching it as the bot is on for any reaction and not stop watching it even when someone reacts to it. 

Current PC: 

Spoiler

Motherboard: MSI Z390-A PRO

CPU: Intel Core i7-9700K @ 3.60GHz

Memory: 32GB (4x8GB) Corsair Vengeance 

Graphics Card: NVIDIA GeForce RTX 3060 Ti

Boot: Crucial P2 500GB (M.2)

SSD: Crucial BX500 1TB

HDD: Seagate ST2000DM001 2TB

HDD: Seagate Barracuda 4TB

PSU: Gigabyte P750GM 750W

Case: IONZ KZ10

Current Laptop:

Spoiler

Name: Lenovo ThinkBook 14 20SL003JUK

CPU: Intel i7-1065G7 @ 3GHz

Graphics: Intel Iris Graphics

RAM: 16GB DDR4 @ 2667MHz

SSD: 480GB Western Digital M.2

Secondary SSD: 240GB Adata SATA

Other Gear:

Spoiler

Phone: Google Pixel 6 (128GB)

Headphones: Steelseries Arctis 3

Microphone: Blue Snowball Ice

Speakers: Creative T100

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×