Skip to content

Commit 732a582

Browse files
author
Eviee Py
committed
Some docs
1 parent 983e3b4 commit 732a582

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

twitchio/ext/commands/bot.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,17 @@ def bot_id(self) -> str:
7777

7878
@property
7979
def owner_id(self) -> str | None:
80+
"""Property returning the ID of the user who owns this bot.
81+
82+
This can be set via the keyword argument `owner_id="..."` in the constructor of this class.
83+
84+
Returns
85+
-------
86+
str
87+
The owner ID that has been set.
88+
None
89+
No owner ID has been set.
90+
"""
8091
return self._owner_id
8192

8293
def _cleanup_component(self, component: Component, /) -> None:

twitchio/ext/commands/context.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ def kwargs(self) -> dict[str, Any]:
123123
return self._kwargs
124124

125125
def is_owner(self) -> bool:
126+
"""Method which returns whether the chatter associated with this context is the owner of the bot.
127+
128+
.. warning::
129+
130+
You must have set the :attr:`~twitchio.Bot.owner_id` first, otherwise this method will always return `False`.
131+
132+
Returns
133+
-------
134+
bool
135+
Whether the chatter that this context is associated with is the owner of this bot.
136+
"""
126137
return self.chatter.id == self.bot.owner_id
127138

128139
def is_valid(self) -> bool:

0 commit comments

Comments
 (0)