示例#1
0
    def __init__(self, bot):
        self.bot: commands.Bot = bot
        conn: SQLDB = self.bot.DBC
        config = bot.config
        #loading hugs
        conn.query("SELECT * FROM hugs")
        hugs = conn.fetch_rows()
        FunCog.hugs = []
        for hug in hugs:
            FunCog.hugs.append(hug["hug"])
        if len(FunCog.hugs) == 0:
            hugs = Util.fetchFromDisk("fun-info")["hugs"]
            for hug in hugs:
                FunCog.hugs.append(hug)
                conn.query(
                    'INSERT INTO hugs (hug, author) VALUES ("%s", "%d")' %
                    (hug, 114407765400748041))

        #loading fights
        conn.query("SELECT * FROM fights")
        fights = conn.fetch_rows()
        FunCog.fights = []
        for fight in fights:
            FunCog.fights.append(fight["fight"])
        if len(FunCog.fights) == 0:
            fights = Util.fetchFromDisk("fun-info")["fights"]
            for fight in fights:
                FunCog.fights.append(fight)
                conn.query(
                    'INSERT INTO fights (fight, author) VALUES ("%s", "%d")' %
                    (fight, 114407765400748041))
示例#2
0
 def __init__(self, bot):
     self.bot = bot
     bot.mutes = self.mutes = Util.fetchFromDisk("mutes")
     self.running = True
     self.bot.loop.create_task(unmuteTask(self))