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)
评论列表
文章目录