Sha256: 02f553d66b69b7e13f82c4855e4ce8c0e3ae6c2dcf356f8187bedb3f558ed442
Contents?: true
Size: 1.31 KB
Versions: 5
Compression:
Stored size: 1.31 KB
Contents
module RoboPigeon::Dsl module Helpers module Slack RoboPigeon::Documentarian.add_command('slack_user_for', block: ['helpers'], params: [{ name: 'search', type: 'String', desc: 'the name, email, or slack handle of a user to search for', example: 'robopigeon@ives.dev' }], desc: 'Searches for a given user and returns a formatted slack message mention') def slack_user_for(*search) uid = RoboPigeon::Slack::Client.get_user(search).try(:id) return '' if uid.nil? "<@#{uid}>" end RoboPigeon::Documentarian.add_command('slack_name_for', block: ['helpers'], params: [{ name: 'search', type: 'String', desc: 'the name, email, or slack handle of a user to search for', example: 'robopigeon@ives.dev' }], desc: 'Searches for a given user and returns their slack handle with an @') def slack_name_for(*search) uid = RoboPigeon::Slack::Client.get_user(search).try(:name) return '' if uid.nil? "@#{uid}" end RoboPigeon::Documentarian.add_command('slack_user_group', block: ['helpers'], params: [{ name: 'id', type: 'String', desc: 'the usergroup id to mention', example: 'robopigeon@ives.dev' }], desc: 'a message formatted mention of the given slack group id') def slack_user_group(id) "<!subteam^#{id}>" end end end end
Version data entries
5 entries across 5 versions & 1 rubygems