Skip to content

Commit 3761de4

Browse files
committed
Add extra docs on getting user IDs
1 parent 134370a commit 3761de4

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

docs/getting-started/faq.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,27 @@ You can also create a :class:`~twitchio.PartialUser` with :meth:`~twitchio.Clien
8383
If you are using :class:`~twitchio.ext.commands.Command`'s or anywhere :class:`~twitchio.ext.commands.Context` is available,
8484
or are receiving a :class:`~twitchio.ChatMessage`, consider looking at :class:`~twitchio.Chatter` for a more complete object
8585
with more information and helpers.
86+
87+
88+
How do I get the user IDs for BOT_ID and OWNER_ID?
89+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
90+
91+
If you do not know your user ID you can quickly fetch it using the :meth:`~twitchio.Client.fetch_users` method.
92+
93+
.. code:: python3
94+
95+
import asyncio
96+
import twitchio
97+
98+
CLIENT_ID: str = "..."
99+
CLIENT_SECRET: str = "..."
100+
101+
async def main() -> None:
102+
async with twitchio.Client(client_id=CLIENT_ID, client_secret=CLIENT_SECRET) as client:
103+
await client.login()
104+
user = await client.fetch_users(logins=["chillymosh", "my_bot"])
105+
for u in user:
106+
print(f"User: {u.name} - ID: {u.id}")
107+
108+
if __name__ == "__main__":
109+
asyncio.run(main())

docs/getting-started/quickstart.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ Before running the code below, there just a couple more steps we need to take.
3737
#. Stop the bot and uncomment everything in ``setup_hook``.
3838
#. Start the bot.
3939

40+
.. note::
41+
If you are unsure how to get the user IDs for BOT_ID and OWNER_ID, please check the `FAQ here </getting-started/faq.html#how-do-i-get-the-user-ids-for-bot-id-and-owner-id>`_.
42+
43+
4044
**You only have to do this sequence of steps once. Or if the scopes need to change.**
4145

4246
.. code:: python3

0 commit comments

Comments
 (0)