Skip to content

Commit d9a601c

Browse files
committed
Add PartialUser v User FAQ
1 parent ff700ae commit d9a601c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/getting-started/faq.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,24 @@ and more.
6262

6363
Used with :class:`~twitchio.ext.commands.Component`'s and hot-reloading extension support you can easily manage your applications
6464
codebase with multiple modules and/or pacakges, with minimal down-time.
65+
66+
67+
Why does TwitchIO use PartialUser in-place of a full User object?
68+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69+
70+
The large majority of both Helix endpoints and EventSub subscriptions from Twitch only send partial data relating to the user.
71+
72+
Creating a complete :class:`~twitchio.User` on all these events and endpoints would mean making an extra HTTP request,
73+
which is both needlessly slow and consumes ratelimit tokens.
74+
75+
Since Twitch only requires the ``ID`` of users to perform actions and make requests, :class:`~twitchio.PartialUser` is an
76+
inexpensive way of having an object that can perform actions for or against the user. However if you need extra data about the
77+
user (such as profile image) you can always fetch the full data via :meth:`twitchio.PartialUser.user`. Since the
78+
:class:`~twitchio.User` subclasses :class:`~twitchio.PartialUser`, all the methods available on :class:`~twitchio.PartialUser`
79+
are also available on :class:`~twitchio.User`.
80+
81+
You can also create a :class:`~twitchio.PartialUser` with :meth:`~twitchio.Client.create_partialuser`.
82+
83+
If you are using :class:`~twitchio.ext.commands.Command`'s or anywhere :class:`~twitchio.ext.commands.Context` is available,
84+
or are receiving a :class:`~twitchio.ChatMessage`, consider looking at :class:`~twitchio.Chatter` for a more complete object
85+
with more information and helpers.

0 commit comments

Comments
 (0)