Message Reactions

idk, it just does.

var Spark = require(“sparkbots”)
const Command = Spark.command(“invite”)
Command.setLevel(10)
Command.allowDms(true)
module.exports = Command;
Command.code = (client, message) => {

That is the code for my invite command, does this explain how it works?

Try connecting with the same session id so it would count as resuming socket connection.

you speaking english bro?

yes… wdym

resuming socket connection? wdym by that?

socket means websockets, which is what many things use for a connection (including discord.js)

instead of long polling

Okay, NVM. Now, I think it should’ve been like this:

const Discord = require(‘discord.js’);
const client = new Discord.Client();

client.once(‘ready’, () => {
console.log(‘Ready!’);
});

client.on('messageReactionAdd', (messageReaction, user) => {
  if(user.bot)  return;
  const { message, emoji } = messageReaction;
   if(emoji.name === "the emoji here") {
     if(message.id === "message id here") {
        message.author.addRole("role-id-goes-here", "Reaction Roles")
      }
    } 
});

Though it’d be useful to check for earlier questions before adding one, such as this one here.

He’s using sparkbots instead of discord.js

Yeah @easrng , would that make a difference in the code?

Wouldn’t it be close to the same? If not can you help?
@MrDiamond64
@youngchief
@FTGxShadow

It shouldn’t, since sparkbots basically use discord.js as well, but i don’t know if they replaced some of the commands.

I’ve tried using that code and it doesn’t work. I’m trying to have the bot react to a specific message (embed) (I haven’t been able to do this so far)

…and then once it does that - I want to be able to connect those reactions to Unbelievaboat and make a store out of them. But the

That code was discord.js v11, check out discord.js.org to learn how to migrate that code to v12

discord.js v11 is also now broken.

also… welcome to glitch!

1 Like

Yes, that code is from 7 months ago, back when discord.js was still v11, you can check and refer to the docs for the new v12 docs.

1 Like