Sha256: ea4a8f5aaced410fa95fc734d82a9afdff1416448c1a420b037b32dbc22f4a57
Contents?: true
Size: 933 Bytes
Versions: 3
Compression:
Stored size: 933 Bytes
Contents
module Lita module Handlers class Confirmation < Handler route /^confirm\s+([a-f0-9]{6})$/i, :confirm, command: true, help: { t("help.key") => t("help.value") } def confirm(response) code = response.matches[0][0] command = Extensions::Confirmation::UnconfirmedCommand.find(code) if command call_command(command, code, response) else response.reply(t("invalid_code", code: code)) end end private def call_command(command, code, response) case command.call(response.user) when :other_user_required response.reply(t("other_user_required", code: code)) when :user_in_group_required response.reply( t("user_in_group_required", code: code, groups: command.groups.join(", ")) ) end end end Lita.register_handler(Confirmation) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lita-confirmation-1.0.1 | lib/lita/handlers/confirmation.rb |
lita-confirmation-1.0.0 | lib/lita/handlers/confirmation.rb |
lita-confirmation-0.0.1 | lib/lita/handlers/confirmation.rb |