Having a problem with reactionRole discord bot

So I recently started to make a discord bot, I’m new to coding but I do have some basic!
So I mainly made the code and it’s working at 90%. The only problem is that when it comes to add or remove the roll. So when the user clicks the emote to get the role the bot reacts to the click but can’t define ‘guild’ so it doesn’t give the role.

module.exports = {
    name: 'reactionrole',
    description: "Best thing!!!",
    async execute(message, args, Discord, bot) {

        const channel = 'the id channel';
        const modRole = message.guild.roles.cache.find(role => role.name === "Mod");
        const defaultRole = message.guild.roles.cache.find(role => role.name === "El Gars");

        const modEmoji = '馃悢';
        const defaultEmoji = '馃挬';

//========== My embed message with the info ========//
        let embed = new Discord.MessageEmbed()
            .setTitle(`just thing`)
            .setDescription(`just thing\n\n`
                + `${modEmoji} bla bla bla\n`
                + `${defaultEmoji} bla bla bla`);

        let messageEmbed = await message.channel.send(embed);
//========== Letting my bot add the reaction ======//

//========== Here to add the role =================//
        bot.on('messageReactionAdd', async (reaction, user) => {
            if (reaction.message.partial) await reaction.message.fetch();
            if (reaction.partial) await reaction.fetch();
            if (user.bot) return;
            if (!reaction.message.guild) return;

            if (reaction.message.channel.id == channel) {
                if (reaction.emoji.name === modEmoji) {
                    await reaction.message, guild, members.cache.get(user.id).roles.add(modRole);
                if (reaction.emoji.name === defaultEmoji) {
                    await reaction.message, guild, members.cache.get(user.id).roles.add(defaultRole);
            } else {

//========= Here to remove the role ============//
        bot.on('messageReactionRemove', async (reaction, user) => {
            if (reaction.message.partial) await reaction.message.fetch();
            if (reaction.partial) await reaction.fetch();
            if (user.bot) return;
            if (!reaction.message.guild) return;

            if (reaction.message.channel.id == channel) {
                if (reaction.emoji.name === modEmoji) {
                    await reaction.message, guild, members.cache.get(user.id).roles.remove(modRole);
                if (reaction.emoji.name === defaultEmoji) {
                    await reaction.message, guild, members.cache.get(user.id).roles.remove(defaultRole);
            } else {


//========== In my main.js =========//

const Discord = require("discord.js");
const config = require("./config.json");
const fs = require('fs');
const bot = new Discord.Client({ partials: ["MESSAGE", "CHANNEL", "REACTION"] });

bot.commands = new Discord.Collection();

const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
  const command = require(`./commands/${file}`);

  bot.commands.set(command.name, command)

bot.on("ready", () => {
  console.log('Bot has started.');

bot.on('guildMemberAdd', guildMember => {
  let welcomeRole = guildMember.guild.roles.cache.find(role => role.name === 'El Gars');

  guildMember.guild.channels.cache.get('id channel').send(`Yo <@${guildMember.user.id}> kes tu criss icit!`)

bot.on('message', message => {
  if (!message.content.startsWith(config.prefix) || message.author.bot) return;

  const args = message.content.slice(config.prefix.length).split(/ +/);
  const command = args.shift().toLowerCase();

  if (command === 'command') {
    bot.commands.get('command').execute(message, args, Discord);

  if (command === 'clear') {
    bot.commands.get('clear').execute(message, args);
  } else if (command === 'ban') {
    bot.commands.get('ban').execute(message, args);
  } else if (command === 'kick') {
    bot.commands.get('kick').execute(message, args);
  } else if (command === 'mute') {
    bot.commands.get('mute').execute(message, args);
  } else if (command === 'unmute') {
    bot.commands.get('unmute').execute(message, args);
  } else if (command === 'reactionrole') {
    bot.commands.get('reactionrole').execute(message, args, Discord, bot);



Here the error:
This is a peek at my error! 馃榾

76 thoughts on “Having a problem with reactionRole discord bot”

  1. Howdy, I think your web site might be having web browser compatibility
    issues. Whenever I take a look at your website in Safari, it
    looks fine however, when opening in Internet Explorer, it has some overlapping issues.
    I just wanted to give you a quick heads up! Other than that, excellent website!

  2. I am not positive where you’re getting your info, however great
    topic. I must spend some time learning much more or understanding more.
    Thank you for magnificent info I used to be on the lookout for this info for my mission.

  3. Oh my goodness! Amazing article dude! Thanks, However I am encountering problems
    with your RSS. I don’t understand the reason why I am unable
    to subscribe to it. Is there anyone else having similar
    RSS problems? Anyone that knows the solution can you kindly respond?

  4. Hi there! Do you use Twitter? I’d like to follow you if that would be ok.
    I’m absolutely enjoying your blog and look forward to new updates.

  5. I was suggested this web site by my cousin. I’m not sure
    whether this post is written by him as no one else know such detailed about my trouble.
    You are amazing! Thanks!

  6. hey there and thank you for your information 鈥 I have certainly picked up something new from right here.
    I did however expertise a few technical points using this site, since I experienced
    to reload the web site many times previous to I could
    get it to load correctly. I had been wondering if your web
    hosting is OK? Not that I am complaining, but sluggish loading instances times will sometimes affect your placement in google and can damage your high quality score if ads and marketing
    with Adwords. Well I am adding this RSS to my e-mail and could look out for a lot more of your respective fascinating content.
    Ensure that you update this again soon.

  7. First off I want to say excellent blog! I had a quick question which I’d like to ask if you do
    not mind. I was interested to find out how you
    center yourself and clear your mind prior to writing. I have had a
    hard time clearing my thoughts in getting my ideas out. I do
    enjoy writing however it just seems like the first 10 to 15 minutes are usually lost just trying to figure out
    how to begin. Any suggestions or hints? Thanks!

  8. It’s really a cool and helpful piece of info. I’m
    glad that you simply shared this helpful info with us. Please stay us up to date like this.
    Thanks for sharing.

  9. Greate post. Keep writing such kind of info on your blog.
    Im really impressed by it.
    Hi there, You’ve done an excellent job. I’ll certainly digg it and
    in my opinion recommend to my friends. I am
    confident they’ll be benefited from this web site.

  10. Admiring the time and energy you put into your blog and in depth information you offer.
    It’s nice to come across a blog every once in a while that isn’t the same unwanted rehashed information.
    Excellent read! I’ve bookmarked your site and I’m adding your RSS feeds to my Google account.

  11. I don’t even know how I ended up here, but I thought this
    post was great. I don’t know who you are but certainly you’re going to a
    famous blogger if you are not already 馃槈 Cheers!

  12. Hi there, You have done a fantastic job. I’ll definitely digg it and personally recommend to my friends.

    I’m confident they’ll be benefited from this site.

  13. Hello! I’ve been reading your site for a while now and finally
    got the courage to go ahead and give you a shout out
    from Humble Tx! Just wanted to say keep up the excellent job!

  14. Excellent article. Keeep posting such kind of information on your blog.

    Im really impressed by your site.
    Hllo there, You’ve performed a fantastic job. I will cdrtainly digg it and in my opinion recommend too my friends.
    I’m sure they will bbe benefited from this webb

    Feel frwe tto surf to my web site; chaturbate.lol

  15. Fantastic blog yoou have here but I was wanting to know if you knew of any user discussion forums that cover the same topics discussed here?
    I’d really like to be a pwrt of community where I caan get suggestions
    from other experienced people that share the same interest.
    If you have any recommendations,please let
    me know. Kudos!

    Here is my webpage … Warner

  16. With havin so much written content do you ever run into any
    issues oof plagorism or copyright infringement?
    My blog has a loot of exclusive content I’ve either
    created myself or outsourced but it seems a lot of it is popping it up all over the
    web without my agreement. Do you know any ways to help protect aghainst content
    from being stolen? I’d really appreciate it.

    Also visit my web blog: filles nues

  17. Woah! I’m really enjoying the template/theme of this website.
    It’s simple, yet effective. A lot of times it’s very hard
    to get that “perfect balance” between user friendliness and visual appeal.

    I must say you have done a great job with this.
    Additionally, the blog loads very quick for me
    on Internet explorer. Exceptional Blog!

    Also visit my webpage: spambot


Leave a Comment