Browse Source

[commands] Change default Bot.owner_ids to consider team roles

pull/9553/head
Rapptz 2 years ago
parent
commit
e414d0fe04
  1. 14
      discord/ext/commands/bot.py

14
discord/ext/commands/bot.py

@ -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…
Cancel
Save