Module: Rumpy::Bot

Defined in:
lib/rumpy.rb

Overview

include this module into your bot’s class

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pid_fileObject (readonly)

Returns the value of attribute pid_file.



57
58
59
# File 'lib/rumpy.rb', line 57

def pid_file
  @pid_file
end

Instance Method Details

#log_file=(logfile) ⇒ Object

if @log_file isn’t set, initialize it



60
61
62
# File 'lib/rumpy.rb', line 60

def log_file=(logfile)
  @log_file ||= logfile
end

#startObject

one and only public function, defined in this module simply initializes bot’s variables, connection, etc. and starts bot



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/rumpy.rb', line 67

def start
  logger_init

  init

  connect

  set_iq_callback
  set_subscription_callback
  set_message_callback

  start_backend_thread
  start_output_queue_thread

  prepare_users

  @logger.info 'Bot is going ONLINE'
  @output_queue.enq Jabber::Presence.new(nil, @status, @priority)

  add_signal_trap

  Thread.stop
rescue => ex
  general_error ex
  exit
end