Class: Cathodic::Chat

Inherits:
Object
  • Object
show all
Defined in:
lib/cathodic/chat.rb

Overview

The chat class represents the twitch.tv chat, you can fetch the embed code or the pop out chat code and links Author::Paul Forti License::MIT -embed : the url to the embed version of the chat -popout : the url used to pop out the chat -emoticons : the hash containing all the serialized emoticons (image url, regexp, etc) -popout_link : the html link used to pop out the chat

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_name) ⇒ Chat

The constructor needs to be given an account name, most likely the one retrieved from the stream’s url -account_name : the account name of the stream’s chat you want to get



14
15
16
17
# File 'lib/cathodic/chat.rb', line 14

def initialize()
	@account_name = 
	generate_links
end

Instance Attribute Details

#embedObject

Returns the value of attribute embed.



10
11
12
# File 'lib/cathodic/chat.rb', line 10

def embed
  @embed
end

#emoticonsObject

Returns the value of attribute emoticons.



10
11
12
# File 'lib/cathodic/chat.rb', line 10

def emoticons
  @emoticons
end

#popoutObject

Returns the value of attribute popout.



10
11
12
# File 'lib/cathodic/chat.rb', line 10

def popout
  @popout
end

Returns the value of attribute popout_link.



10
11
12
# File 'lib/cathodic/chat.rb', line 10

def popout_link
  @popout_link
end

Instance Method Details

#fetch_emoticonsObject

This method fetchs the emoticons info about a stream’s chat. It takes a lot of CPU, memory and the query is pretty big Don’t use it unless you REALLY need the emoticons



21
22
23
24
# File 'lib/cathodic/chat.rb', line 21

def fetch_emoticons
	query_point = "https://api.twitch.tv/kraken/chat/"+@account_name+"emoticons"
	@emoticons = open(query_point).read
end