@@ -0,0 +1,2641 @@
+/*%0A * Copyright (C) 2017 Dennis Neufeld%0A *%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU Affero General Public License as published%0A * by the Free Software Foundation, either version 3 of the License, or%0A * (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU Affero General Public License for more details.%0A *%0A * You should have received a copy of the GNU Affero General Public License%0A * along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0A%0Apackage space.npstr.wolfia;%0A%0Aimport net.dv8tion.jda.core.entities.Member;%0Aimport net.dv8tion.jda.core.entities.Message;%0Aimport net.dv8tion.jda.core.events.message.react.GenericMessageReactionEvent;%0Aimport net.dv8tion.jda.core.hooks.ListenerAdapter;%0A%0Aimport java.util.concurrent.TimeUnit;%0Aimport java.util.function.Consumer;%0Aimport java.util.function.Predicate;%0A%0A/**%0A * Created by napster on 18.06.17.%0A * %3Cp%3E%0A * A self destructing listener for reactions to a single message%0A */%0Apublic class ReactionListener extends ListenerAdapter %7B%0A%0A    private final long messageId;%0A    private final Predicate%3CMember%3E filter;%0A    private final Consumer%3CGenericMessageReactionEvent%3E callback;%0A%0A    /**%0A     * @param message            The message on which to listen for reactions%0A     * @param filter             filter by Members%0A     * @param callback           wat do when a reaction happens that went through the filter%0A     * @param selfDestructMillis milliseconds after which this listener is removed and the message deleted%0A     */%0A    public ReactionListener(final Message message, final Predicate%3CMember%3E filter, final Consumer%3CGenericMessageReactionEvent%3E callback,%0A                            final long selfDestructMillis, final Consumer%3CVoid%3E selfDestructCallback) %7B%0A        this.messageId = message.getIdLong();%0A        this.filter = filter;%0A        this.callback = callback;%0A%0A        Wolfia.executor.schedule(() -%3E %7B%0A            //remove the listener%0A            Wolfia.jda.removeEventListener(this);%0A            selfDestructCallback.accept(null);%0A        %7D, selfDestructMillis, TimeUnit.MILLISECONDS);%0A    %7D%0A%0A    @Override%0A    public void onGenericMessageReaction(final GenericMessageReactionEvent event) %7B%0A        if (this.messageId != event.getMessageIdLong()) %7B%0A            return;%0A        %7D%0A%0A        if (!this.filter.test(event.getMember())) %7B%0A            return;%0A        %7D%0A%0A        this.callback.accept(event);%0A    %7D%0A%7D%0A%0A

Add a ReactionListener