Answer the question
In order to leave comments, you need to log in
How to make an action on a reaction?
Greetings.
How to make an action when clicking on a reaction under a bot message?
Discord.JS Version 12.2.0
Answer the question
In order to leave comments, you need to log in
this can be done with the help of the so-called "listeners", using events like ReactionAdd
, ReactionRemove
. . .
and also, you can use collectors .
the second option in the code looks much more concise, and does not take up extra space - I advise you to use it.
const filter = (reaction, user) => {
return reaction.emoji.name === 'здесь_указываете_нужную_реакцию'
};
const collector = message.createReactionCollector(filter, { time: 15000 });
/*
у данного метода существует несколько других ключевых слов, помимо time,
для более тонкой работы с реакциями.
на простой коллектор - достаточно будет указать время сбора реакций
(в нашем случае - 15 секунд).
*/
collector.on('collect', (reaction, user) => {
// действия, которые произойдут при нажатии пользователя на реакцию.
});
collector.on('end', collected => {
// действия, которые произойдут после остановки коллектора.
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question