lib/lita/handlers/help.rb in lita-3.3.1 vs lib/lita/handlers/help.rb in lita-4.0.0.rc1

- old
+ new

@@ -20,17 +20,19 @@ private # Checks if the user is authorized to at least one of the given groups. def authorized?(user, required_groups) required_groups.nil? || required_groups.any? do |group| - Lita::Authorization.user_in_group?(user, group) + robot.auth.user_in_group?(user, group) end end # Creates an array of help info for all registered routes. def build_help(response) - Lita.handlers.map do |handler| + robot.handlers.map do |handler| + next unless handler.respond_to?(:routes) + handler.routes.map do |route| route.help.map do |command, description| if authorized?(response.user, route.required_groups) help_command(route, command, description) end @@ -56,10 +58,10 @@ "#{command} - #{description}" end # The way the bot should be addressed in order to trigger a command. def name - Lita.config.robot.mention_name || Lita.config.robot.name + robot.config.robot.mention_name || robot.config.robot.name end end Lita.register_handler(Help) end