Sha256: d3532d8d3c0e222795ba563a56b159390b39ac9aceb51bf2f82d221361ab35a5
Contents?: true
Size: 1.58 KB
Versions: 8
Compression:
Stored size: 1.58 KB
Contents
# lita-jira plugin module Lita # Because we can. module Handlers # Utilities class JiraUtility < Handler namespace 'Jira' include ::JiraHelper::Issue include ::JiraHelper::Misc include ::JiraHelper::Regex include ::JiraHelper::Utility route( /^jira\sidentify\s#{EMAIL_PATTERN}$/, :identify, command: true, help: { t('help.identify.syntax') => t('help.identify.desc') } ) route( /^jira\sforget$/, :forget, command: true, help: { t('help.forget.syntax') => t('help.forget.desc') } ) route( /^jira\swhoami$/, :whoami, command: true, help: { t('help.whoami.syntax') => t('help.whoami.desc') } ) def identify(response) email = response.match_data['email'] return response.reply(t('error.already_identified', email: get_email(response.user))) if user_stored?(response.user) store_user!(response.user, email) response.reply(t('identify.stored', email: email)) end def forget(response) return response.reply(t('error.not_identified')) unless user_stored?(response.user) delete_user!(response.user) response.reply(t('identify.deleted')) end def whoami(response) return response.reply(t('error.not_identified')) unless user_stored?(response.user) response.reply(t('identify.email', email: get_email(response.user))) end Lita.register_handler(JiraUtility) end end end
Version data entries
8 entries across 8 versions & 1 rubygems