Im doing a OOP project for school in which i have create a bot in ruby. My dilemma is that i want to keep my routes in the
file generated when creating a new handler but move the response methods to a bin folder outside of the lib folder.
so for example my handler would be named dialog
the file structure would look like so
lita-dialog/lib/lita/handlers/dialog.rb
module Lita
module Handlers
class Dialog < Handler
# insert handler code here
route(/.*hello|hi|good morning|morning|welcome.*/i, :greeting_response, command: true)
Lita.register_handler(self)
end
end
end
this would house my routes, then i would want my responses to be in
require_relative '../lib/lita/handlers/dialog.rb'
In testing when testing the routes to the responses they are passing but when i interact with the bot the bot does response when given keyword commands
that should trigger a response.
im getting this error when i run 'lita'
Passing 'id' command to redis as is; blind passthrough has been deprecated and will be removed in redis-namespace 2.0 (at /Users/aulbournknowles/.r│~ │~
benv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/did_you_mean-1.3.0/lib/did_you_mean/core_ext/name_error.rb:8:in `inspect') │~ │~
[2020-05-14 19:42:20 UTC] ERROR: Lita::Handlers::Dialog crashed. The exception was: │~ │~
undefined method `greeting_response' for #<Lita::Handlers::Dialog:0x00007fad9b8ed988> │~ │~
Full backtrace: │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/callback.rb:31:in `public_send' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/callback.rb:31:in `call' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/handler/chat_router.rb:97:in `dispatch_to_route' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/handler/chat_router.rb:82:in `block in dispatch' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/handler/chat_router.rb:72:in `map' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/handler/chat_router.rb:72:in `dispatch' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/robot.rb:69:in `block in receive' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/2.6.0/set.rb:338:in `each_key' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/2.6.0/set.rb:338:in `each' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/robot.rb:66:in `map' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/robot.rb:66:in `receive' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/adapters/shell.rb:94:in `block in run_loop' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/adapters/shell.rb:85:in `loop' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/adapters/shell.rb:85:in `run_loop' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/adapters/shell.rb:34:in `run' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/robot.rb:80:in `run' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita.rb:80:in `run' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/lib/lita/cli.rb:77:in `start' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/base.rb:485:in `start' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/lita-4.7.1/bin/lita:6:in `<top (required)>' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/bin/lita:23:in `load' │~ │~
/Users/aulbournknowles/.rbenv/versions/2.6.5/bin/lita:23:in `<main>'
how could i fix this please.