Added server password stuff from Javier.
parent
5d48dd8ca7
commit
22aed08fae
3
bot.py
3
bot.py
|
@ -22,7 +22,8 @@ def decode(bytes):
|
|||
|
||||
class Phenny(irc.Bot):
|
||||
def __init__(self, config):
|
||||
irc.Bot.__init__(self, config.nick, config.name, config.channels)
|
||||
args = (config.nick, config.name, config.channels, config.password)
|
||||
irc.Bot.__init__(self, *args)
|
||||
self.config = config
|
||||
self.doc = {}
|
||||
self.stats = {}
|
||||
|
|
5
irc.py
5
irc.py
|
@ -25,7 +25,7 @@ class Origin(object):
|
|||
self.sender = mappings.get(target, target)
|
||||
|
||||
class Bot(asynchat.async_chat):
|
||||
def __init__(self, nick, name, channels):
|
||||
def __init__(self, nick, name, channels, password=None):
|
||||
asynchat.async_chat.__init__(self)
|
||||
self.set_terminator('\n')
|
||||
self.buffer = ''
|
||||
|
@ -33,6 +33,7 @@ class Bot(asynchat.async_chat):
|
|||
self.nick = nick
|
||||
self.user = nick
|
||||
self.name = name
|
||||
self.password = password
|
||||
|
||||
self.verbose = True
|
||||
self.channels = channels or []
|
||||
|
@ -79,6 +80,8 @@ class Bot(asynchat.async_chat):
|
|||
def handle_connect(self):
|
||||
if self.verbose:
|
||||
print >> sys.stderr, 'connected!'
|
||||
if self.password:
|
||||
self.write(('PASS', self.password))
|
||||
self.write(('NICK', self.nick))
|
||||
self.write(('USER', self.user, '+iw', self.nick), self.name)
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ def f_title(self, origin, match, args):
|
|||
return
|
||||
|
||||
u = urllib2.urlopen(req)
|
||||
bytes = u.read(32768)
|
||||
bytes = u.read(262144)
|
||||
u.close()
|
||||
|
||||
except IOError:
|
||||
|
|
|
@ -47,7 +47,7 @@ def stats(phenny, input):
|
|||
channels = {}
|
||||
|
||||
ignore = set(['f_note', 'startup', 'message', 'noteuri'])
|
||||
for (name, user), count in phenny.stats.iteritems():
|
||||
for (name, user), count in phenny.stats.items():
|
||||
if name in ignore: continue
|
||||
if not user: continue
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ def replaced(phenny, input):
|
|||
'pc': '.pc has been replaced by .u',
|
||||
'unicode': '.unicode has been replaced by .u',
|
||||
'compare': '.compare has been replaced by .gcs (googlecounts)',
|
||||
'map': 'the .map command has been removed; ask sbp for details',
|
||||
# 'map': 'the .map command has been removed; ask sbp for details',
|
||||
'acronym': 'the .acronym command has been removed; ask sbp for details',
|
||||
# 'img': 'the .img command has been removed; ask sbp for details',
|
||||
'v': '.v has been replaced by .val',
|
||||
|
|
9
phenny
9
phenny
|
@ -30,8 +30,7 @@ def create_default_config(fn):
|
|||
channels = ['#example', '#test']
|
||||
owner = 'yournickname'
|
||||
|
||||
# This isn't implemented yet:
|
||||
# serverpass = 'yourserverpassword'
|
||||
# password = 'yourserverpassword'
|
||||
|
||||
# These are people who will be able to use admin.py's functions...
|
||||
admins = [owner, 'someoneyoutrust']
|
||||
|
@ -43,7 +42,8 @@ def create_default_config(fn):
|
|||
#
|
||||
# enable = []
|
||||
|
||||
# Directories to load opt modules from
|
||||
# Directories to load user modules from
|
||||
# e.g. /path/to/my/modules
|
||||
extra = []
|
||||
|
||||
# Services to load: maps channel names to white or black lists
|
||||
|
@ -135,6 +135,9 @@ def main(argv=None):
|
|||
if not hasattr(module, 'port'):
|
||||
module.port = 6667
|
||||
|
||||
if not hasattr(module, 'password'):
|
||||
module.password = None
|
||||
|
||||
if module.host == 'irc.example.net':
|
||||
error = ('Error: you must edit the config file first!\n' +
|
||||
"You're currently using %s" % module.filename)
|
||||
|
|
Loading…
Reference in New Issue