-
-
Save zipkid/22be5ae8edb003f3c5c2 to your computer and use it in GitHub Desktop.
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
#!/bin/env ruby | |
# encoding: utf-8 | |
require 'slack-rtmapi' | |
require 'pp' | |
token = '<token>' | |
channel = '<channel_id>`' | |
slack_rtm = SlackRTM.new(token: token) | |
slack_rtm.start_rtm | |
Thread.new do | |
loop do | |
sleep_time = 5 | |
puts Time.new.inspect | |
slack_rtm.client.send(type: 'message', channel: channel, text: "It's #{Time.new.inspect}") | |
sleep sleep_time | |
end | |
end | |
slack_rtm.client.main_loop | |
assert false # never ending loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment