api.py 文件源码

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

项目:Dwarf 作者: Dwarf-Community 项目源码 文件源码
def new_role(self, role, guild=None):
        """Creates a new Dwarf ?Role? object and connects it to the database.

        Parameters
        ----------
        role
            Can be a Discord ?Role? object or a role ID.
        guild : Optional
            Can be a Discord ?Server? object or a guild ID.
            Is not an optional parameter if ?role? is not a Discord ?Role? object.
        """

        if isinstance(role, discord.Role):
            return Role(id=role.id)
        else:
            if guild is None:
                raise ValueError("Either a Role object or both role ID "
                                 "and guild ID must be given as argument(s)")
            return Role(id=role)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号