Class: Agig::Session

Inherits:
Net::IRC::Server::Session
  • Object
show all
Defined in:
lib/agig/session.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Session

Returns a new instance of Session.



20
21
22
23
# File 'lib/agig/session.rb', line 20

def initialize(*args)
  super
  @notification_last_retrieved = @watch_last_retrieved = Time.now.utc - 3600
end

Instance Method Details

#channelsObject



16
17
18
# File 'lib/agig/session.rb', line 16

def channels
  ['#notification', '#watch']
end

#clientObject



25
26
27
# File 'lib/agig/session.rb', line 25

def client
  @client ||= Octokit::Client.new(access_token: @pass)
end

#on_disconnectedObject



29
30
31
# File 'lib/agig/session.rb', line 29

def on_disconnected
  @retrieve_thread.kill rescue nil
end

#on_user(m) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/agig/session.rb', line 33

def on_user(m)
  super

  channels.each{|channel| post @nick, JOIN, channel }

  @retrieve_thread = Thread.start do
    loop do
      retrieve @opts.interval
    end
  end
end

#server_nameObject



8
9
10
# File 'lib/agig/session.rb', line 8

def server_name
  "github"
end

#server_versionObject



12
13
14
# File 'lib/agig/session.rb', line 12

def server_version
  Agig::VERSION
end