Skip to content

Commit db90f7e

Browse files
Lulalabyplun1331
andauthored
fix: don't consider read_only as app owner (#3207)
Co-authored-by: plun1331 <plun1331@gmail.com>
1 parent ef93ef9 commit db90f7e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

discord/bot.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,8 @@ async def is_owner(self, user: User | Member) -> bool:
14411441
this bot.
14421442
14431443
If an :attr:`owner_id` is not set, it is fetched automatically
1444-
through the use of :meth:`~.Bot.application_info`.
1444+
through the use of :meth:`~.Bot.application_info`, returning
1445+
the application owner, or all non read-only team members.
14451446
14461447
.. versionchanged:: 1.3
14471448
The function also checks if the application is team-owned if
@@ -1465,7 +1466,9 @@ async def is_owner(self, user: User | Member) -> bool:
14651466
else:
14661467
app = await self.application_info() # type: ignore
14671468
if app.team:
1468-
self.owner_ids = ids = {m.id for m in app.team.members}
1469+
self.owner_ids = ids = {
1470+
m.id for m in app.team.members if m.role != "read_only"
1471+
}
14691472
return user.id in ids
14701473
else:
14711474
self.owner_id = owner_id = app.owner.id
@@ -1491,11 +1494,12 @@ class Bot(BotBase, Client):
14911494
owner_id: Optional[:class:`int`]
14921495
The user ID that owns the bot. If this is not set and is then queried via
14931496
:meth:`.is_owner` then it is fetched automatically using
1494-
:meth:`~.Bot.application_info`.
1497+
:meth:`~.Bot.application_info`, returning the application owner.
14951498
owner_ids: Optional[Collection[:class:`int`]]
14961499
The user IDs that owns the bot. This is similar to :attr:`owner_id`.
14971500
If this is not set and the application is team based, then it is
1498-
fetched automatically using :meth:`~.Bot.application_info`.
1501+
fetched automatically using :meth:`~.Bot.application_info`,
1502+
returning all non read-only team members.
14991503
For performance reasons it is recommended to use a :class:`set`
15001504
for the collection. You cannot set both ``owner_id`` and ``owner_ids``.
15011505

0 commit comments

Comments
 (0)