roles.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:TnyBot-Discord 作者: 00firestar00 项目源码 文件源码
def _get_all(self, server: Server, is_primary: int = None) -> List:
        """ Internal helper method to fetch role and alias
        """
        primary_in = "(0,1)"
        if is_primary == 1:
            primary_in = "(1)"

        if is_primary == 0:
            primary_in = "(0)"

        self.cursor.execute(
            self.query(
                "SELECT role, alias FROM roles WHERE is_primary IN {0} AND server_id = %(server)s".format(primary_in)),
            {"server": server.id})
        rows = self.cursor.fetchall()
        ret_list = []
        for r in rows:
            role, alias = r
            ret_list.append((str(role), alias))
        return ret_list
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号