def __init__(self, api_key, mods_, whitelist, overseer):
self.api_key = api_key
self.bot = telepot.Bot(self.api_key)
self.overseer = overseer
logging.debug(self.bot.getMe())
self.reactiontime = 10 # messages older than this won't be answered
self.mods=[]
for m in mods_:
exec("import mods.{}".format(m)) # totally insecure
logging.debug("exec mod=mods.{0}.{0}(self)".format(m))
exec("mod=mods.{0}.{0}(self)".format(m))
self.mods.append(locals()['mod'])
# if feedback from the mod is needed
# start a thread here, e.g.
# thread.start_new_thread(self.modHandling,(mod,))
# to use this, use queue_out in each mod
import ast #json would require strings as keys
self.whitelist=ast.literal_eval(whitelist)
self.bot.message_loop(self.recv)
评论列表
文章目录