-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set listeners in a loop #7
Comments
I currently implemented this in my bot by using the same handler and checking msg.Match[0] inside the handler. This requires a regex match though, which is only a minor tradeoff. I'm still unsure why the loop with closures didn't work and would love to figure that out. |
That is weird indeed. Do you have a more complete example? This code seems fine, you're not even passing pointers, only copies of strings, and you create a new Listener on each iteration. Hmm. |
I have a bot that has a few very simple responses. I tried doing the following to register multiple listeners on the bot calling
initSimple
from within aInitPlugin
func and passing it the reference to the bot.The problem is that every "query" into simpleResponses returns the response from the last response, e.g. "response2" in this case. I've also tried generating a listener for every case and handing them to the bot one for one, but that leads to the same result.
Any help on how to achieve this would be much appreciated 😊
The text was updated successfully, but these errors were encountered: