changes analyzebehaviour to react to sent messages as well -> not only received messages
@@ -4,6 +4,8 @@ import won.bot.framework.eventbot.EventListenerContext;
import won.bot.framework.eventbot.action.impl.analyzation.AnalyzeAction;
import won.bot.framework.eventbot.event.impl.wonmessage.MessageFromOtherNeedEvent;
import won.bot.framework.eventbot.event.impl.wonmessage.OpenFromOtherNeedEvent;
+import won.bot.framework.eventbot.event.impl.wonmessage.WonMessageSentOnConnectionEvent;
+import won.bot.framework.eventbot.filter.impl.OrFilter;
import won.bot.framework.eventbot.listener.impl.ActionOnEventListener;
import java.util.Optional;
@@ -22,17 +24,10 @@ public class AnalyzeBehaviour extends BotBehaviour{
@Override
protected void onActivate(Optional<Object> message) {
- this.subscribeWithAutoCleanup(MessageFromOtherNeedEvent.class,
- new ActionOnEventListener(
- context,
- new AnalyzeAction(context)
- )
- );
- this.subscribeWithAutoCleanup(OpenFromOtherNeedEvent.class,
- new ActionOnEventListener(
- context,
- new AnalyzeAction(context)
- )
- );
+ ActionOnEventListener analyzeAction = new ActionOnEventListener(context, new AnalyzeAction(context));
+
+ this.subscribeWithAutoCleanup(MessageFromOtherNeedEvent.class, analyzeAction);
+ this.subscribeWithAutoCleanup(OpenFromOtherNeedEvent.class, analyzeAction);
+ this.subscribeWithAutoCleanup(WonMessageSentOnConnectionEvent.class, analyzeAction);
}
}
