class TickingAway::ChatBot
Public Class Methods
new(server, channels)
click to toggle source
# File lib/ticking_away/chat_bot.rb, line 11 def initialize(server, channels) @server = server @channels = channels @bot = nil end
Public Instance Methods
start()
click to toggle source
# File lib/ticking_away/chat_bot.rb, line 17 def start # Required for dealing with scope. # The block provided when instantiating the # bot and the configuration block only have the # scope of the start method while the start # method has access to the class's instance vars # The block cannot access the class's instance vars # unless they're assigned to a var in the method's scope # Good target for some refactoring server = @server channels = @channels @bot = Cinch::Bot.new do configure do |c| c.server = server c.channels = channels c.nick = 'TickingAwayBot' c.plugins.plugins = [TickingAway::TimeInfo] end end @bot.start end
stop()
click to toggle source
# File lib/ticking_away/chat_bot.rb, line 41 def stop @bot.stop end