mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
[commands] Change default Bot.owner_ids to consider team roles
This commit is contained in:
parent
f74eb14d72
commit
e414d0fe04
@ -499,6 +499,12 @@ class BotBase(GroupMixin[None]):
|
||||
|
||||
``user`` parameter is now positional-only.
|
||||
|
||||
.. versionchanged:: 2.4
|
||||
|
||||
This function now respects the team member roles if the bot is team-owned.
|
||||
In order to be considered an owner, they must be either an admin or
|
||||
a developer.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
user: :class:`.abc.User`
|
||||
@ -516,9 +522,13 @@ class BotBase(GroupMixin[None]):
|
||||
return user.id in self.owner_ids
|
||||
else:
|
||||
|
||||
app = await self.application_info() # type: ignore
|
||||
app: discord.AppInfo = await self.application_info() # type: ignore
|
||||
if app.team:
|
||||
self.owner_ids = ids = {m.id for m in app.team.members}
|
||||
self.owner_ids = ids = {
|
||||
m.id
|
||||
for m in app.team.members
|
||||
if m.role in (discord.TeamMemberRole.admin, discord.TeamMemberRole.developer)
|
||||
}
|
||||
return user.id in ids
|
||||
else:
|
||||
self.owner_id = owner_id = app.owner.id
|
||||
|
Loading…
x
Reference in New Issue
Block a user