Esempio n. 1
0
 async def insert(self, uid: int, reason, executor_id: int):
     await db.Database.insert(db.Database(self.bot),
                              table="blacklist",
                              rows=["uid", "reason", "executor_id"],
                              values=[uid, reason, executor_id])
     blacklisted.append(uid)
     print(f"[BLACKLIST] Blacklisted {self.bot.get_user(uid)} (ID: {uid})")
Esempio n. 2
0
 async def load_trusts(self):
     try:
         trusts = await db.Database.get_dict(db.Database(self.bot), "trust")
         for user in trusts:
             if trusts[user] > 5:
                 trusts[user] = 5
             trusted[user] = trusts[user]
         print(f"[TRUST] {trusted}")
     except Exception as error:
         print(error)
Esempio n. 3
0
 async def untrust(self, uid: int):
     trusted.pop(uid)
     await db.Database.remove(db.Database(self.bot), "trust", "uid", uid)
Esempio n. 4
0
 async def trust(self, uid: int, perm_level: int = 1):
     if perm_level > 5:
         perm_level = 5
     trusted[uid] = perm_level
     await db.Database.insert(db.Database(self.bot), "trust",
                              ["uid", "perm_level"], [uid, perm_level])
Esempio n. 5
0
 async def insert(self, uid: int, description):
     await db.Database.insert(db.Database(self.bot), "profile",
                              ["uid", "description"], [uid, description])
Esempio n. 6
0
 async def load_profiles(self):
     profile_list = await db.Database.get_list(db.Database(self.bot), "uid",
                                               "profile")
     for profile_id in profile_list:
         profiles.append(profile_id)
Esempio n. 7
0
 async def delete(self, uid: int):
     await db.Database.remove(db.Database(self.bot), "profile", "uid", uid)
Esempio n. 8
0
 async def get(self, uid: int):
     return await db.Database.get_single(db.Database(self.bot),
                                         "description", "profile", "uid",
                                         uid)
Esempio n. 9
0
 async def get_all(self, uid: int):
     record = await db.Database.get_all(db.Database(self.bot), "blacklist",
                                        "uid", uid)
     return record[0]
Esempio n. 10
0
 async def get(self, uid: int, row):
     return await db.Database.get_single(db.Database(self.bot), row,
                                         "blacklist", "uid", uid)
Esempio n. 11
0
 async def load_blacklist(self):
     blacklists = await db.Database.get_list(db.Database(self.bot), "uid",
                                             "blacklist")
     for blacklist in blacklists:
         blacklisted.append(blacklist)
     print(f"[BLACKLIST] {blacklisted}")
Esempio n. 12
0
 async def remove(self, uid: int):
     blacklisted.remove(uid)
     await db.Database.remove(db.Database(self.bot), "blacklist", "uid",
                              uid)