Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
🐛 [Bugfix] Error when channel not passed into add_roles
Browse files Browse the repository at this point in the history
  • Loading branch information
foxwhite25 committed May 13, 2022
1 parent 12089fe commit cf76376
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions qq/member.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ async def add_roles(
添加这些身份组的原因。
atomic: :class:`bool`
是否以 atomic 方式添加身份组。这将确保无论缓存的当前状态如何,都将始终应用多个操作。
channel: Optional[:class: `abc.GuildChannel`]
channel: Optional[:class:`abc.GuildChannel`]
仅在添加身份组为 5 (子频道管理员) 的时候需要
Raises
Expand All @@ -355,7 +355,7 @@ async def add_roles(
guild_id = self.guild.id
user_id = self.id
for role in roles:
await req(guild_id, user_id, role.id, channel.id, reason=reason)
await req(guild_id, user_id, role.id, channel.id if channel else None, reason=reason)

async def remove_roles(
self, *roles: Role,
Expand All @@ -374,7 +374,7 @@ async def remove_roles(
删除这些身份组的原因。
atomic: :class:`bool`
是否以 atomic 方式删除身份组。这将确保无论缓存的当前状态如何,都将始终应用多个操作。
channel: Optional[:class: `abc.GuildChannel`]
channel: Optional[:class:`abc.GuildChannel`]
仅在添加身份组为 5 (子频道管理员) 的时候需要
Raises
Expand All @@ -399,7 +399,7 @@ async def remove_roles(
guild_id = self.guild.id
user_id = self.id
for role in roles:
await req(guild_id, user_id, role.id, channel.id, reason=reason)
await req(guild_id, user_id, role.id, channel.id if channel else None, reason=reason)

def get_role(self, role_id: int, /) -> Optional[Role]:
return self.guild.get_role(role_id) if self._roles.has(role_id) else None
Expand Down

0 comments on commit cf76376

Please sign in to comment.