def getguild(self, id: int): if not self.r.exists(id): return guild = self.r.get(id) guild = l(guild) return guild
def getrole(self, id: int, role: str = None): guild = self.getguild(id=id) if guild: g = guild['roles'] g = {k: l(g.get(k)) for k in g.keys()} if role: return g[role] return g
def getchannel(self, id: int, channel: str = None): guild = self.getguild(id=id) if guild: if channel is None: return guild['channels'] g = guild['channels'][channel] g = {k: l(g.get(k)) for k in g.keys()} return g
def getfilter(self, id: int, filter: str = None): guild = self.getguild(id=id) if guild: g = guild['filters'] g = {k: l(g.get(k)) for k in g.keys()} for k in list(g.keys())[1:]: g[k] = self.str2bool(flag=g[k]) if filter: return g[filter] return g
def fetch(self, name: str): em = self.r.get(name) return l(em)
def getprefix(self, id: int): guild = self.getguild(id=id) if guild: return l(guild['prefix'])