Commit c72f6f99 authored by Jyrki's avatar Jyrki 🐾

Make /help useful

parent 22d6c880
......@@ -9,6 +9,10 @@ module UseCase
raise NotImplementedError.new("Implement #{self.class}.command_name!")
end
def self.help_text
""
end
abstract def call(bot : TelegramBot::Bot, msg : TelegramBot::Message, params : Array(String)?)
end
end
......
......@@ -9,10 +9,18 @@ module UseCase
"help"
end
def self.help_text
"Displays this list of commands, duh."
end
def call(bot, msg, params)
bot.reply msg, <<-EOF
Right now, I only know about this one command here. Sorry to disappoint.
EOF
bot.reply msg, "I know the following commands:\n\n#{formatted_commands}"
end
private def formatted_commands
{{ UseCase::SlashCommands::Base.subclasses }}.reject(&.help_text.empty?).map do |klass|
" ➢ /#{klass.command_name} - #{klass.help_text}"
end.join("\n")
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment