Add reaction fetching of users

This commit is contained in:
Amish Shah
2016-10-27 16:58:06 +01:00
parent 8e505ed349
commit dd9c291508
3 changed files with 45 additions and 0 deletions

View File

@@ -187,3 +187,19 @@ client.on('messageReactionRemove', (reaction, user) => {
if (reaction.message.channel.id !== '222086648706498562') return;
reaction.message.channel.sendMessage(`${user.username} removed reaction ${reaction.emoji}, count is now ${reaction.count}`);
});
client.on('message', m => {
if (m.content.startsWith('#reactions')) {
const mID = m.content.split(' ')[1];
m.channel.fetchMessage(mID).then(rM => {
for (const reaction of rM.reactions.values()) {
reaction.fetchUsers().then(users => {
m.channel.sendMessage(
`The following gave that message ${reaction.emoji}:\n` +
`${users.map(u => u.username).map(t => `- ${t}`).join('\n')}`
);
});
}
});
}
});