@@ -42,17 +42,26 @@ public abstract class BaseBot {
4242 */
4343 public BaseBot () {
4444 Method [] methods = this .getClass ().getMethods ();
45+
46+ // Gather conversation methods first to prevent these from using as event methods
4547 for (Method method : methods ) {
4648 if (method .isAnnotationPresent (Controller .class )) {
4749 Controller controller = method .getAnnotation (Controller .class );
48- EventType [] eventTypes = controller .events ();
49- String pattern = controller .pattern ();
50- int patternFlags = controller .patternFlags ();
5150 String next = controller .next ();
5251
5352 if (!StringUtils .isEmpty (next )) {
5453 conversationMethodNames .add (next );
5554 }
55+ }
56+ }
57+
58+ for (Method method : methods ) {
59+ if (method .isAnnotationPresent (Controller .class )) {
60+ Controller controller = method .getAnnotation (Controller .class );
61+ EventType [] eventTypes = controller .events ();
62+ String pattern = controller .pattern ();
63+ int patternFlags = controller .patternFlags ();
64+ String next = controller .next ();
5665
5766 MethodWrapper methodWrapper = new MethodWrapper ();
5867 methodWrapper .setMethod (method );
@@ -75,6 +84,8 @@ public BaseBot() {
7584 methodNameMap .put (method .getName (), methodWrapper );
7685 }
7786 }
87+
88+
7889 }
7990
8091 protected void startConversation (String id , String methodName ) {
0 commit comments