async def set_guild(self, values: Sequence): """ Set a guild row. :param values: the values of that row. """ assert_types(values, _guild_types, True) await self.pool.execute(self.__set_guild, *values)
async def set_user(self, values: Sequence): """ Set a user row. :param values: the values of that row. """ assert_types(values, _user_types, True) await self.pool.execute(self.__set_user, *values)
def get_roles(self, guild_id: int) -> List[str]: """ Get the list of roles in the guild. :param guild_id: the guild id. """ res = self.__get_guild_row(guild_id).roles if res is not None: assert_types(res, str, False) return res
async def get_guild(self, guild_id: str) -> tuple: """ Get guild row by id. :param guild_id: the guild id. :return: the guild row. """ _res = await self.pool.fetchrow(self.__get_guild, guild_id) res = _parse_record(_res) or (None, ) * len(_guild_types) assert_types(res, _guild_types, True) return res
async def get_user(self, user_id: str) -> tuple: """ Get a user row. :param user_id: the user id. :return: the values of that row. """ _res = await self.pool.fetchrow(self.__get_user, user_id) res = _parse_record(_res) or (None, ) * len(_user_types) assert_types(res, _user_types, True) return res
async def set_roles(self, guild_id: int, roles: List[str]): """ Set the role list for the guild. :param guild_id: the guild id. :param roles: the list of roles. """ assert_types(roles, str, False) row = self.__get_guild_row(guild_id) await row.set_roles(roles)
async def get_member(self, member_id: str, guild_id: str) -> tuple: """ Get a member row. :param member_id: the member id. :param guild_id: the guild id. :return: the member row. """ _res = await self.pool.fetchrow(self.__get_member, member_id, guild_id) res = _parse_record(_res) or (None, ) * len(_member_types) assert_types(res, _member_types, True) return res