message.channel.send(``DBump Reminders` Have been enabled`)
message.channel.send(``DBump Reminders` What role would you like to ping? If None response with N`)
const returnedMessageContent = await new Promise((resolve) => {
const messageCollector = message.channel.createMessageCollector({ time: 60000 });
messageCollector.on('collect', (msg) => {
if (msg.author.id !== message.author.id) return;
if(msg.content === 'N') return message.channel.send('Enabled without Ping')
console.log(message.mentions.roles.first())
const role = message.mentions.roles.first()
if(msg.content.replace(/D+/g, '') !== role.id){
message.channel.send(`No Role was Found`)
} else {
message.channel.send(`${role} was set as the bump ping`)
}
messageCollector.stop();
resolve(msg.content);
});
messageCollector.on('end', (collected, reason) => {
if (reason === 'time') {
message.channel.send('Time ran out, please call the command again');
resolve(null);
}
});
});
I’m trying to wait for user response however It can’t read mentioned roles
[Mursy] Unhandled Rejection: TypeError: Cannot read properties of undefined (reading ‘id’)
at MessageCollector. (C:UsersawesoDesktopMursy – CopyMursyFilesCommandsTesttest.js:36:49)
at MessageCollector.emit (node:events:390:28)
at MessageCollector.handleCollect (C:UsersawesoDesktopMursy – CopyMursynode_modulesdiscord.jssrcstructuresinterfacesCollector.js:109:12)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
this is the error I keep getting