Example #1
0
def makeconsoleconfig(opts=None, botname=None):
    """ make config file based on options. """
    if not botname: botname = opts.name or "default-console" 
    botname = stripname(botname)
    from tl.lib.config import Config
    cfg = Config('fleet' + os.sep + botname + os.sep + 'config')
    cfg.type = "console"
    cfg.name = botname
    uid = get_uid()
    if not cfg.owner: cfg.owner = []
    if uid not in cfg.owner: cfg.owner.append(uid) ; cfg.save()
    if opts and opts.loglevel: cfg.loglevel = opts.loglevel
    else: cfg.loglevel = cfg.loglevel or "error"
    return cfg
Example #2
0
    def parse(self, bot, input, console, *args, **kwargs):
        """ overload this. """
        if not input: raise NoInput()
        self.bot = bot
        self.console = console
        self.userhost = get_uid()
        try: self.nick = self.userhost.split("@")[0]
        except: self.nick = "nonick"
        self.origin = self.userhost
        self.txt = input
        self.channel = self.userhost
        self.cbtype = self.cmnd = "CONSOLE"
        self.showall = True
        self.prepare()
        return self

        
Example #3
0
 def __init__(self, username, klacht, default={}, ddir=None, origin=None, *args, **kwargs):
     TimedPersist.__init__(self, username, default=default, ddir=getklachtdir(username), *args, **kwargs)
     self.data.klacht = self.data.klacht or klacht or "geen text gegeven"
     self.data.username = self.data.username or username or "anon"
     self.data.uid = self.data.uid or get_uid(username)
     self.data.origin = self.data.origin or origin or get_id()