mvbot icon indicating copy to clipboard operation
mvbot copied to clipboard

Update code for Discord.js 13.x (suggestion / note for later)

Open jmmelko opened this issue 3 years ago • 1 comments

FYI,

if you update Discord.js you'll have to modify the base branch as follows:

var bot = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }); // NEW

  try {
    bot.user.setPresence({
        activities: [{
            name: 'ver. ' + pkg_info.version
        }],
        status: 'online'
    })
  } catch (error) {
    console.error(error); //NEW
  }
    // console.log('mvbot ready!\n');
});

if (!message.member.permissions.has(Permissions.FLAGS.MANAGE_MESSAGES)) 

because:

  • client instanciation requires Intents
  • setpresence no longer returns a Promise object (so .then does no longer work)
  • use of explicit strings for permissions is discouraged

Also, message.send has been deprecated, and replaced messageCreation, but I haven't figured the exact syntax yet

chers,

jmmelko avatar Oct 03 '21 10:10 jmmelko

Thanks for the insight and taking the time to look into it. This will certainly be helpful when I get around to updating this project again.

tmanifold avatar Oct 03 '21 16:10 tmanifold