-1
votes

I'm creating a ticket / modmail bot and I want to have a command that you can select the category on where the threads (tickets) will go, with that said I am looking for some clarification on whether this is the right code for that.

const channel = message.mentions.channels.first() || message.guild.channels.cache.find(c => c.id === args[0])
      if(!channel) return message.reply(unablec)

Yes, there is more code that follows this line but I am more concerned on this.

Appreciate the help. (discord.js 12)

1
What is the intended behavior of the two lines you have? - bordeaux
As far as I can tell, message.mentions is a MessageMentions class. According to the documentation, message.mentions does not have a parent property. - bordeaux
The intended behavior of the two lines I provided is for when the user invokes the command, !channelset <#channel>. The message the user chooses to send will appear in the <#channel>. - ignshifts

1 Answers

0
votes

Your code should work if the rest of your code works i cant really tell because you only added 2 lines of code and that is pretty small This code should work

const channel = message.mentions.channels.first() || message.guild.channels.cache.find(c => c.id === args[0])
      if(!channel) return message.reply(unablec)

but what is unablec... if it is a message everything there should work by message i mean something like this

// an embed message
const unablec = new MessageEmbed().setTitle('Some text').setDescription('Some Description');
// or is it a "normal" message
const unablec = 'This is a message';