dbuser = 'bot'
dbpass = 'roboticism'
dbname = 'bot'
-rootdir = '/home/ophion'
+rootdir = '/home/bots/'
logfile = rootdir+'/output.log'
excfile = rootdir+'/exception.log'
-oidfile = '/home/ophion/.oidentd.conf'
-identprefix = 'jobbig' # ident will be <identprefix><bot ID#>
+oidfile = '/home/bots/.oidentd.conf'
+identprefix = 'ophion' # ident will be <identprefix><bot ID#>
import socket, select, sys, os, signal, time
from threading import *
self.nick = row['nick']
self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- self.s.bind((row['vhost'], 0))
+ if row['vhost'] is not None:
+ self.s.bind((row['vhost'], 0))
self.s.connect((row['irchost'], row['ircport']))
self.rawnow("NICK %s" % (self.nick))
self.rawnow("USER %s * * :%s" % (ident, row['realname']))
def __repr__(self): return "<Bot%d: %s>" % (self.id, self.nick)
class Cache:
+ # config
+ lshost = '0.0.0.0'
+ lsport = 13245
+ moduledata = '/home/bots/modules/'
+ trigger = '!'
+ cmsgs = { # %(id)d = bot id, %(msg)s = log message.
+ 'debug': "\00303[\037DEBUG\037][%(id)d]: %(msg)s",
+ 'info': "\00312[\037INFO\037][%(id)d]: %(msg)s",
+ 'warn': "\00306[\037WARN\037][%(id)d]: %(msg)s",
+ 'fatal': "\00304[\037FATAL\037][%(id)d]: %(msg)s",
+ }
+
+
+ # NOT config
dbc = None
ls = None
admins = {}
users = {}
chans = {}
- ## CONFIG
- lshost = '0.0.0.0'
- lsport = 13245
- triviapath = '/home/ophion/modules/trivia/'
- trigger = '!'
- cmsgs = {
- 'debug': "\00303[\037DEBUG\037][%(id)d]: %(msg)s",
- 'info': "\00312[\037INFO\037][%(id)d]: %(msg)s",
- 'warn': "\00306[\037WARN\037][%(id)d]: %(msg)s",
- 'fatal': "\00304[\037FATAL\037][%(id)d]: %(msg)s",
- }
-
def __init__(self):
global cache
cache = self
cache.trivia = {}
try:
- qfile = open(cache.triviapath+"/questions.txt", 'r')
+ qfile = open(cache.moduledata+"/trivia/questions.txt", 'r')
except IOError as e:
print_exc(None, cache.excfile)
return True
qfile.close()
try:
- ptsfile = open(cache.triviapath+"/points.json", 'r')
+ ptsfile = open(cache.moduledata+"/trivia/points.json", 'r')
except IOError as e:
print_exc(None, cache.excfile)
return True
global questions, points
cache.currmod = __name__
- ptsfile = open(cache.triviapath+"/points.json", 'w')
+ ptsfile = open(cache.moduledata+"/trivia/points.json", 'w')
json.dump(points, ptsfile, indent=4)
ptsfile.close()