Class: Cinch::Plugins::TwitchTV

Inherits:
Object
  • Object
show all
Includes:
Cinch::Plugin
Defined in:
lib/cinch/plugins/twitch.rb,
lib/cinch/plugins/twitch/version.rb

Overview

Versioning info

Constant Summary collapse

VERSION =
'0.0.3'

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ TwitchTV

Returns a new instance of TwitchTV.



14
15
16
17
18
# File 'lib/cinch/plugins/twitch.rb', line 14

def initialize(*args)
  super
  @streamid = config[:streamid]
  @currently_live = live?
end

Instance Method Details

#execute(m) ⇒ Object



20
21
22
# File 'lib/cinch/plugins/twitch.rb', line 20

def execute(m)
  m.reply stream_message, true
end

#live_checkObject



24
25
26
27
28
29
30
31
32
# File 'lib/cinch/plugins/twitch.rb', line 24

def live_check
  if @currently_live == live?
    debug "Stream is currently [#{live? ? 'Online' : 'Offline'}]"
    return
  end
  debug "Stream status changed to [#{live? ? 'Online' : 'Offline'}]"
  @bot.channels.first.msg(online_message) if live?
  @currently_live = live?
end