I am trying to make a modmail system and whenever it creates a ticket, it logs your id in quick.db (for sending messages from the dm to the support ticket), Although, whenever I try to do that, it returns the ID for the bot.
Here is the code I use
client.on('message', message => {
if(db.has(`ticket-${message.author.id}`)){
console.log(message.author.id)
if(message.channel.type == "dm"){
const channel = client.channels.cache.find(c => c.name === `ticket-${message.author.id}` && c.type === 'text');
channel.send(message.content)
}
}
})
Whenever I open a ticket and send something it sends the bots id in the console, not my own. I am using version 12 for this project
channel.send(message.content) emits the message event just like any other user message. To ignore bot messages add
if (message.author.bot) return;
To the top of your message listener.
client.on('message', message => {
if (message.author.bot) return;
// Your Code ...
})