-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Commands that delegate to controllers incorrectly raise NotImplementedError
when called
#175
Comments
Can you try to turn this into a failing spec and make a PR? We (you) should be able to fix it from there. |
Sure thing! |
@dblock I was able to reproduce the issue in spec. It looks like in a normal command class (not using MVC) where the name matches, if you haven't put any command blocks in it, it would correctly raise However if you have a command class that delegates to MVC controller that does have methods in it, if one of the methods doesn't match the command class name, then it incorrectly raises In a normal command, if I had named the class |
I'm still getting familiar with the code base, so I'm not sure what the solution is yet but if you have any ideas on how to proceed I'd love to take a stab at the implementation. |
I don't understand that command
behavior and crashes the botNotImplementedError
when called
I originally wrote the MVC support. Let me take a quick peek at this and hopefully I can guide you on the best way to solve it. I'll ping here tomorrow. |
Awesome! Thanks @chuckremes! |
My laptop is on the fritz. Need a genius bar visit before I can really look at this. Sorry for delay. |
I am getting the same error after upgrading 0.14 -> 0.15 on my controllers
|
@jasonwc There are probably a few ways of solving this problem. Here's one suggestion. Note this line in the code: Instead of blindly That's probably the easiest approach. If you want a little more magic, you could add a If you want some help, ping me here. |
I realized my occurence of the bug was because I had not totally migrated from pure command to MVC and that a |
Thanks for looking into it @chuckremes! Been busy but I'll try to make some progress on this issue this weekend. |
@jasonwc Sounds fine. Again, if you want to bounce some ideas around or need a hand with figuring out the right approach, ping me here. |
Hey @dblock! Been loving this library for building some internal tooling at my company, but I've encountered an issue recently when trying to use the MVC architecture of SlackRubyBot.
My original use case was to create a controller to do CRUD on a server to facilitate adding and viewing "interestings" that people had learned at work throughout the week.
I structured it similar to a Rails MVC architecture:
interestings add
interestings list
These were defined in a controller called the
InterestingsController
that implemented the following methods:def interestings_add
def interestings_list
It was important that it be scoped to
interestings
as I'm also intending to work on a retro helper allowing users to submit good, bad, and meh items in advance of their team retrospectives. That would likely have a similarretro add
,retro list
, etc... interface and so I needed to scopeadd
,list
commands accordingly.I started having problems where if a user typed
interestings
followed by any non command text, the slack bot would crash and not recover. This would also happen if the user happened to just typeinterestings
.I ended up just defining an
interestings
method to return help about the controller methods. It will trigger on any message to the bot starting withinterestings
that is not an existing command (e.g. interestings list).Another case that I encountered was where the controller was named to encompass its actions (i.e. group all the commands related to viewing information about, announcing deploys, etc.. for our various production applications under an
AppsController
). In that case, I don't really want to define anapps
command as the interface isn't@bot apps do something
, I would much rather just have it send back the standardSorry @user, I don't understand that command!
.Anyway, I wanted to report this to see if I was misunderstanding or setting up my controllers/views/models incorrectly.
I created a sample repo to reproduce this issue here. It implements a greetings controller with the same issue.
References:
Logs
The text was updated successfully, but these errors were encountered: