mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-20 15:41:09 +01:00
Updated to use a cooler config file.
This commit is contained in:
parent
07ba0d5bbe
commit
8f683713de
@ -46,6 +46,7 @@ import utils
|
|||||||
import privmsgs
|
import privmsgs
|
||||||
import callbacks
|
import callbacks
|
||||||
import structures
|
import structures
|
||||||
|
import unpreserve
|
||||||
|
|
||||||
class AliasError(Exception):
|
class AliasError(Exception):
|
||||||
pass
|
pass
|
||||||
@ -165,6 +166,7 @@ class Alias(callbacks.Privmsg):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.aliasCommand = None
|
self.aliasCommand = None
|
||||||
self.aliasLocked = None
|
self.aliasLocked = None
|
||||||
|
self.setAliasName = False
|
||||||
|
|
||||||
def badCommand(self, command, rest, lineno):
|
def badCommand(self, command, rest, lineno):
|
||||||
raise ValueError, \
|
raise ValueError, \
|
||||||
@ -174,6 +176,7 @@ class Alias(callbacks.Privmsg):
|
|||||||
if self.aliasName is not None:
|
if self.aliasName is not None:
|
||||||
raise ValueError, \
|
raise ValueError, \
|
||||||
'Unexpected alias command at line %s' % lineno
|
'Unexpected alias command at line %s' % lineno
|
||||||
|
self.setAliasName = True
|
||||||
AliasCreator.aliasName = rest
|
AliasCreator.aliasName = rest
|
||||||
|
|
||||||
def command(self, rest, lineno):
|
def command(self, rest, lineno):
|
||||||
@ -186,17 +189,16 @@ class Alias(callbacks.Privmsg):
|
|||||||
if self.aliasName is None:
|
if self.aliasName is None:
|
||||||
raise ValueError, \
|
raise ValueError, \
|
||||||
'Unexpected alias configuration at line %s' % lineno
|
'Unexpected alias configuration at line %s' % lineno
|
||||||
self.aliasLocked = rest
|
self.aliasLocked = bool(eval(rest))
|
||||||
|
|
||||||
def finish(self):
|
def finish(self):
|
||||||
if self.aliasCommand is None:
|
if self.setAliasName:
|
||||||
raise ValueError, \
|
return
|
||||||
'Unexpected end of alias configuration at line %s' \
|
|
||||||
% lineno
|
|
||||||
aliases[self.aliasName] = (self.aliasCommand, self.aliasLocked)
|
aliases[self.aliasName] = (self.aliasCommand, self.aliasLocked)
|
||||||
AliasCreator.aliasName = None
|
AliasCreator.aliasName = None
|
||||||
reader = unpreserve.Reader(AliasCreator)
|
reader = unpreserve.Reader(AliasCreator)
|
||||||
reader.readFile(filename)
|
reader.readFile(filename)
|
||||||
|
self.aliases = aliases
|
||||||
|
|
||||||
def __call__(self, irc, msg):
|
def __call__(self, irc, msg):
|
||||||
# Adding the aliases requires an Irc. So the first time we get called
|
# Adding the aliases requires an Irc. So the first time we get called
|
||||||
|
Loading…
x
Reference in New Issue
Block a user