G
G
getaxe2021-01-18 08:50:25
Node.js
getaxe, 2021-01-18 08:50:25

How to remove the response message from the bot about the lack of rights discord.js?

I need that if the person has a lack of rights, both the trigger message is deleted, and after a time (let it be 5 seconds) the message of the bot itself.

if (!role.has(roles.admin)) { 
        message.channel.send(`У вас недостаточно прав.`);
        //удаление сообщения "у вас недостаточно прав".
    } else {
    //выполнение команды
    }
message.delete();

ps with role check everything is ok, shortened by constants and json files.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-01-18
@getaxe

message.channel.send(`У вас недостаточно прав.`)
  .then(m => m.delete({
    timeout: 5000
  }))

or
message.channel.send(`У вас недостаточно прав.`).then(m => {
  setTimeout(() => {
    m.delete();
  }, 5000)
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question