-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcontroller.rb
50 lines (39 loc) · 901 Bytes
/
controller.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env ruby
###################################
# GLOBAL VARIABLES - DEFINE THESE #
# Eventually will be moved to #
# an external conf file
###################################
# File locations
$root_dir = "/home/tiwillia/Projects/Swagbot"
$ircfile = "#{$root_dir}/swagbot.rb"
# Server Settings
$server = "irc.devel.redhat.com"
$port = "6667"
# Initial bot settings
$botname = "betabot"
$channel = "#betabot"
#Configurable bot options
$karma_wait = 5
$nickserv_password = "swagswag"
#################################
class Controller
require 'socket'
def initialize
load $ircfile
new_bot($botname, $channel)
end
def new_bot(nick, channel)
bot = Swagbot.new($server, $port, nick, channel, $root_dir)
puts bot.inspect.split
bot.connect()
puts "Connected, begining running loop"
running_loop(bot)
end
def running_loop(bot)
loop do
bot.loop()
end
end
Controller.new()
end