Skip to content

Instantly share code, notes, and snippets.

@benjaminjackson
Created May 13, 2017 20:44
Show Gist options
  • Save benjaminjackson/c9ae41baa981cf46348c8211c7dcfdd1 to your computer and use it in GitHub Desktop.
Save benjaminjackson/c9ae41baa981cf46348c8211c7dcfdd1 to your computer and use it in GitHub Desktop.
This will ping every single user on your Slack team every time they go active with "u up?"
require 'slack-ruby-bot'
class UUpBot < SlackRubyBot::Bot
command 'yeah' do |client, data, match|
client.say(text: 'me too', channel: data.channel)
end
end
class UUpServer < SlackRubyBot::Server
on 'presence_change' do |client, message|
username = client.users[message.user].name
if message.presence == 'active' && username != client.name
client.web_client.chat_postMessage(text: 'u up?', channel: "@" + username, as_user: true)
end
end
end
UUpBot.run
run UUpServer.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment