class Socrates::Bots::Slack::Ping
Attributes
client[R]
Public Class Methods
new()
click to toggle source
# File lib/socrates/bots/slack/ping.rb, line 5 def initialize logger = Logger.new($stdout) # The ping is going to run every minute, so don't be too chatty logger.level = Logger::WARN @client = ::Slack::Web::Client.new( token: ENV.fetch("SLACK_API_TOKEN"), logger: logger ) end
Public Instance Methods
alive?()
click to toggle source
# File lib/socrates/bots/slack/ping.rb, line 16 def alive? auth = client.auth_test presence = client.users_getPresence(user: auth["user_id"]) presence.online? end