use of won.bot.framework.eventbot.behaviour.FactoryBotInitBehaviour in project webofneeds by researchstudio-sat.
the class FactoryBot method initializeEventListeners.
@Override
protected final void initializeEventListeners() {
if (!(super.getBotContextWrapper() instanceof FactoryBotContextWrapper)) {
logger.error("FactoryBot does not work without a FactoryBotContextWrapper");
throw new IllegalStateException("FactoryBot does not work without a FactoryBotContextWrapper");
}
if (getNeedProducer() == null) {
logger.error("FactoryBots do not work without a set needProducer");
throw new IllegalStateException("FactoryBots do not work without a set needProducer");
}
EventListenerContext ctx = getEventListenerContext();
BotBehaviour factoryBotInitBehaviour = new FactoryBotInitBehaviour(ctx);
BotBehaviour factoryBotHintBehaviour = new FactoryBotHintBehaviour(ctx);
BotBehaviour messageCommandBehaviour = new ExecuteWonMessageCommandBehaviour(ctx);
BotBehaviour runningBehaviour = new BotBehaviour(ctx) {
@Override
protected void onActivate(Optional<Object> message) {
initializeFactoryEventListeners();
}
};
factoryBotInitBehaviour.onDeactivateActivate(runningBehaviour, factoryBotHintBehaviour, messageCommandBehaviour);
factoryBotInitBehaviour.activate();
}
Aggregations