Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

419
Views
create a text channel on message react(limit to specific message or specific channel)

(node:19040) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'guild' of undefined at Client. (C:\Users\admin\Desktop\Commendbot\app.js:90:30)

bot.on("messageReactionAdd", async (reaction, user, message) => { //Add an event listener
if (reaction.message.partial) await reaction.message.fetch();
const channels = message.guild.channels.cache
channels.find(channel => channel.name === 'createchannel')

if (user.id === client.user.id) return; //If the reaction was from the bot, return
if (!reaction.message.guild) return; //If the reaction was not in a guild

if (reaction.emoji.name === "๐Ÿ‘") {
  let guild = reaction.message.guild
  guild.channels.create(`channel-${user.id}`, { //Creating the channel
      type: 'text', //Make sure the channel is type is text
      permissionOverwrites: [ //Set overwrites
          {
              id: guild.id,
              allow: ['VIEW_CHANNEL'],
          }]
      })
}

});

about 4 years ago ยท Juan Pablo Isaza
1 answers
Answer question

0

messageReactionAdd only gives 2 objects: the MessageReaction and User. You can get the message from the reaction

const channels = reaction.message.guild.channels.cache
about 4 years ago ยท Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!