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})")
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)
async def untrust(self, uid: int): trusted.pop(uid) await db.Database.remove(db.Database(self.bot), "trust", "uid", uid)
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])
async def insert(self, uid: int, description): await db.Database.insert(db.Database(self.bot), "profile", ["uid", "description"], [uid, description])
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)
async def delete(self, uid: int): await db.Database.remove(db.Database(self.bot), "profile", "uid", uid)
async def get(self, uid: int): return await db.Database.get_single(db.Database(self.bot), "description", "profile", "uid", uid)
async def get_all(self, uid: int): record = await db.Database.get_all(db.Database(self.bot), "blacklist", "uid", uid) return record[0]
async def get(self, uid: int, row): return await db.Database.get_single(db.Database(self.bot), row, "blacklist", "uid", uid)
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}")
async def remove(self, uid: int): blacklisted.remove(uid) await db.Database.remove(db.Database(self.bot), "blacklist", "uid", uid)