Jump to content

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

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 P3 2TB M.2

SSD: Crucial BX500 1TB SSD

SSD: Crucial P2 500GB M.2

PSU: Gigabyte P750GM 750W

Case: IONZ KZ10

"Server": 

Spoiler

Motherboard: X99 RSA mATX (eBay special)

CPU: Intel Xeon E5-2680 v4 @ 2.4GHz

Memory: 64GB (2x32GB) Dataram ECC DDR4

Graphics Card: NVIDIA Quadro P2000

Boot: Kingston NV3 1TB M.2

PSU: Corsair CX550

Case: Fractal Design Core 1000

OS: Proxmox Virtual Environment

Other Gear:

Spoiler

Phone: Google Pixel 6 (128GB)

Watch: Google Pixel Watch

 

Headphones: SteelSeries Arctis 3

Microphone: Blue Snowball Ice

Speakers: Creative T100

 

Car: 2010 Mazda 3 Takuya - 1.6L Petrol 103bhp

Link to comment
https://linustechtips.com/topic/1101277-nodejs-issue/
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`

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 P3 2TB M.2

SSD: Crucial BX500 1TB SSD

SSD: Crucial P2 500GB M.2

PSU: Gigabyte P750GM 750W

Case: IONZ KZ10

"Server": 

Spoiler

Motherboard: X99 RSA mATX (eBay special)

CPU: Intel Xeon E5-2680 v4 @ 2.4GHz

Memory: 64GB (2x32GB) Dataram ECC DDR4

Graphics Card: NVIDIA Quadro P2000

Boot: Kingston NV3 1TB M.2

PSU: Corsair CX550

Case: Fractal Design Core 1000

OS: Proxmox Virtual Environment

Other Gear:

Spoiler

Phone: Google Pixel 6 (128GB)

Watch: Google Pixel Watch

 

Headphones: SteelSeries Arctis 3

Microphone: Blue Snowball Ice

Speakers: Creative T100

 

Car: 2010 Mazda 3 Takuya - 1.6L Petrol 103bhp

Link to comment
https://linustechtips.com/topic/1101277-nodejs-issue/#findComment-12866411
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
https://linustechtips.com/topic/1101277-nodejs-issue/#findComment-12867190
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. 

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 P3 2TB M.2

SSD: Crucial BX500 1TB SSD

SSD: Crucial P2 500GB M.2

PSU: Gigabyte P750GM 750W

Case: IONZ KZ10

"Server": 

Spoiler

Motherboard: X99 RSA mATX (eBay special)

CPU: Intel Xeon E5-2680 v4 @ 2.4GHz

Memory: 64GB (2x32GB) Dataram ECC DDR4

Graphics Card: NVIDIA Quadro P2000

Boot: Kingston NV3 1TB M.2

PSU: Corsair CX550

Case: Fractal Design Core 1000

OS: Proxmox Virtual Environment

Other Gear:

Spoiler

Phone: Google Pixel 6 (128GB)

Watch: Google Pixel Watch

 

Headphones: SteelSeries Arctis 3

Microphone: Blue Snowball Ice

Speakers: Creative T100

 

Car: 2010 Mazda 3 Takuya - 1.6L Petrol 103bhp

Link to comment
https://linustechtips.com/topic/1101277-nodejs-issue/#findComment-12868583
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. 

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 P3 2TB M.2

SSD: Crucial BX500 1TB SSD

SSD: Crucial P2 500GB M.2

PSU: Gigabyte P750GM 750W

Case: IONZ KZ10

"Server": 

Spoiler

Motherboard: X99 RSA mATX (eBay special)

CPU: Intel Xeon E5-2680 v4 @ 2.4GHz

Memory: 64GB (2x32GB) Dataram ECC DDR4

Graphics Card: NVIDIA Quadro P2000

Boot: Kingston NV3 1TB M.2

PSU: Corsair CX550

Case: Fractal Design Core 1000

OS: Proxmox Virtual Environment

Other Gear:

Spoiler

Phone: Google Pixel 6 (128GB)

Watch: Google Pixel Watch

 

Headphones: SteelSeries Arctis 3

Microphone: Blue Snowball Ice

Speakers: Creative T100

 

Car: 2010 Mazda 3 Takuya - 1.6L Petrol 103bhp

Link to comment
https://linustechtips.com/topic/1101277-nodejs-issue/#findComment-12871461
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

×