Created
May 13, 2017 20:44
-
-
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?"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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