def convertpickle(src, target): p = gozerbot.compat.persist.Persist(src) if p and p.data: pers = Persist(target) if not pers.data: pers.data = {} pers.data.update(p.data) try: pers.save() except TypeError: pers2 = Persist(target) if not pers2.data: pers2.data = {} for item, value in p.data.iteritems(): pers2.data[jsonstring(item)] = value pers2.save()
""" command aliases """ __copyright__ = 'this file is in the public domain' # gozerbot imports from gozerbot.persist.persist import Persist from gozerbot.datadir import datadir # basic import import os # the aliases object aliases = Persist(datadir + os.sep + 'aliases.new', init=False) if not aliases.data: aliases.data = {} def aliasreverse(what): """ get the reverse of an alias. """ for i, j in aliases.data.iteritems(): if what == j: return i def aliascheck(ievent): """ check if alias is available. """ try: cmnd = ievent.txt.split()[0] alias = aliases.data[cmnd]
# """ command aliases """ __copyright__ = 'this file is in the public domain' # gozerbot imports from gozerbot.persist.persist import Persist from gozerbot.datadir import datadir # basic import import os # the aliases object aliases = Persist(datadir + os.sep + 'aliases.new', init=False) if not aliases.data: aliases.data = {} def aliasreverse(what): """ get the reverse of an alias. """ for i, j in aliases.data.iteritems(): if what == j: return i def aliascheck(ievent): """ check if alias is available. """ try: cmnd = ievent.txt.split()[0]