как использовать костюм смайлика на ожидающей реакции? - PullRequest
1 голос
/ 07 мая 2020

Я сделал это, но когда я поставил смайлик костюма, он не работает, он работает только с смайликами Unicode.

message.react('707879839943753758').then(() => message.react('?'));

const filter = (reaction, user) => {
    return ['707879839943753758', '?'].includes(reaction.emoji.name) && user.id === message.author.id;
};

message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
    .then(collected => {
        const reaction = collected.first();

        if (reaction.emoji.name === '707879839943753758') {
            message.reply('report something');
        } else {
            message.reply('did not report anything');
        }
    })
    .catch(collected => {
        message.reply('you reacted with neither a thumbs up, nor a thumbs down.');
    });

что мне нужно изменить, чтобы это сработало ??

1 Ответ

1 голос
/ 07 мая 2020

Вам необходимо get() пользовательский смайлик перед его использованием, открыв коллекцию emojis client и получив пользовательский смайлик:

const customEmoji = client.emojis.cache.get('707879839943753758');

message.react(customEmoji).then(() => message.react('?'));

const filter = (reaction, user) => {
    return user.id === message.author.id;
};

message.awaitReactions(filter, {
        max: 1,
        time: 60000,
        errors: ['time']
    })
    .then(collected => {
        const reaction = collected.first();

        if (reaction.emoji.id === customEmoji.id) {
            message.reply('report something');
        }
        if (reaction.emoji.name === '?') {
            message.reply('did not report anything');
        }
    })
    .catch(collected => {
        message.reply('you reacted with neither a thumbs up, nor a thumbs down.');
    });
...