BotMill / fb-botmill

A Java framework for building bots on Facebook's Messenger Platform.
MIT License
72 stars 26 forks source link

Cannot pass parameter 'envelope' to bot controller methods #122

Closed kravchenko-rn closed 7 years ago

kravchenko-rn commented 7 years ago

For exaple: @FbBotMillController(eventType = FbBotMillEventType.MESSAGE_PATTERN, pattern = "(?i:hi)|(?i:hello)|(?i:hey)|(?i:good day)|(?i:home)") public void replyWithQuickReply(MessageEnvelope envelope) { ... } will not work. A message ivent will not be created because the following block in buildAnnotatedBehaviour() method fails: try { FbBotMillController e = (FbBotMillController)method.getAnnotation(FbBotMillController.class); this.event = this.toEventActionFrame(e); method.invoke(this, new Object[0]); } catch (Exception var7) { logger.error(var7.getMessage()); }

It fails on the line method.invoke(this, new Object[0]);

alvin-reyes commented 7 years ago

This will be fixed on the new version as well.

alvin-reyes commented 7 years ago

It seems that you're using an older version of the api. Please pull the latest change and make sure to go thru the documentation (readme file) and go thru the step by step process (we've recently introduce a change on the way the one time configuration is set up).

alvin-reyes commented 7 years ago

I tested this with a brand new bot and it seems to be working as expected. Please open a new issue if it persisted on your end.