Track emoji usage in messages and reactions#1449
Track emoji usage in messages and reactions#1449barsh404error wants to merge 1 commit intoTogether-Java:developfrom
Conversation
|
|
||
| @Override | ||
| public void onMessageReceived(MessageReceivedEvent event) { | ||
| if (event.getAuthor().isBot() || event.isWebhookMessage()) { |
There was a problem hiding this comment.
Remove event.getAuthor().isBot() - we want to track our own usage too (later, it'll be a dimension)
|
|
||
| @Override | ||
| public void onMessageReactionAdd(MessageReactionAddEvent event) { | ||
| if (event.getUser() != null && event.getUser().isBot()) { |
There was a problem hiding this comment.
Remove this if-statement since we want to track bots - we don't want to delete emoji's that we use internally after all
| } | ||
|
|
||
| private void trackEmojiUnion(EmojiUnion emoji) { | ||
| if (emoji.getType() == Emoji.Type.CUSTOM) { |
There was a problem hiding this comment.
Remove this if-statement because it's already only going to show custom emoji's because of getCustomEmojis()
| if (emoji.getType() == Emoji.Type.CUSTOM) { | ||
| trackCustomEmoji(emoji.asCustom()); | ||
| } else { | ||
| metrics.count("emoji-unicode-" + emoji.asUnicode().getName()); |
There was a problem hiding this comment.
Remove this else statement - unicode emoji's won't ever be the case because of getCustomEmojis() and we also don't care about unicode emoji's
| public EmojiTrackerListener(Metrics metrics) { | ||
| super(ALL_CHANNELS); |
There was a problem hiding this comment.
There is no need for this ALL_CHANNELS, check out the no-arg super constructor from MessageReceiverAdapter :)
What
Adds
EmojiTrackerListenerto track emoji usage across messages and reactions.Why
Closes #1445
How
MessageReceiverAdapterand listens to all channelsgetMentions().getCustomEmojis()onMessageReactionAddemoji-custom-animated-{id}emoji-unicode-{name}Features.java