DM discord bot >>JavaScript

if(command === "ticket") {
        console.log(`ticket demmandé`)
        message.channel.send(` **Nouveau Ticket** \r\n${message.author.username},voulez vous faire un nouveau ticket ?`)
        .then(message => {
            message.react('🆗')
            client.on('messageReactionAdd', (reaction, user) => {
                if (reaction.emoji.name === '🆗' && user.id !== client.user.id) {
                    message.author.createDM().then(channel => {
                        channel.send('nfugsfrbdi')
                    })

it is my code :

why this error ? :

(node:44928) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user
    at item.request.gen.end (c:\Users\Arthur\Desktop\TICKET BOT\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15)
    at then (c:\Users\Arthur\Desktop\TICKET BOT\node_modules\snekfetch\src\index.js:215:21)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:44928) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
warning.js:18
(node:44928) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

please help me !

1 Like

Hi @abysbit,

This post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our community organized so users can more easily find information.

As you’ll notice, your topic is now here in the Programming Help board. No action is needed on your part; you can continue the conversation as normal here.

Cheers!

1 Like
if(command === "ticket") {
        console.log(`ticket demmandé`)
        message.channel.send(` **Nouveau Ticket** \r\n${message.author.username},voulez vous faire un nouveau ticket ?`)
        .then(message => {
            message.react('🆗')
            client.on('messageReactionAdd', (reaction, user) => {
                if (reaction.emoji.name === '🆗' && user.id !== client.user.id) {
                    message.author.createDM().then(channel => {
                        message.channel.send("Does it work?")
                    })