use of de.btobastian.javacord.listener.message.ReactionRemoveAllListener in project Javacord by BtoBastian.
the class MessageReactionRemoveAllHandler method handle.
@Override
public void handle(JSONObject packet) {
// {"message_id":"269166028959776768","channel_id":"81402706320699392"}
String messageId = packet.getString("message_id");
final Message message = api.getMessageById(messageId);
if (message == null) {
return;
}
final List<Reaction> reactions = message.getReactions();
((ImplMessage) message).removeAllReactionsFromCache();
listenerExecutorService.submit(new Runnable() {
@Override
public void run() {
List<ReactionRemoveAllListener> listeners = api.getListeners(ReactionRemoveAllListener.class);
synchronized (listeners) {
for (ReactionRemoveAllListener listener : listeners) {
try {
listener.onReactionRemoveAll(api, message, reactions);
} catch (Throwable t) {
logger.warn("Uncaught exception in ReactionRemoveAllListener!", t);
}
}
}
}
});
}
Aggregations