diff --git a/docs/docs_user.rst b/docs/docs_user.rst new file mode 100644 index 000000000..70cf51b2d --- /dev/null +++ b/docs/docs_user.rst @@ -0,0 +1,67 @@ +.. include:: ./vars.rst + +User Documentation +================== + +The User Class is used to represent data about users. + +Attributes +---------- + +username +~~~~~~~~ + +A `String` that is the username of the user. + +discriminator +~~~~~~~~~~~~~ + +Used to differentiate users with the same username, provided by Discord. If you want to differentiate users, we'd recommend using the `id` attribute. + +id +~~ + +A `String` UUID of the user, will never change. + +avatar +~~~~~~ + +A `String` that is the user's avatar's ID, or if they don't have one this is `null`. + +avatarURL +~~~~~~~~~ + +A `String` that points to the user's avatar's URL, or if they don't have an avatar this is `null`. + +status +~~~~~~ + +The status of the user as a `String`; offline/online/idle. + +----- + +Functions +--------- + +mention() +~~~~~~~~~ + +Returns a `String`. This function will generate the mention string for the user, which when sent will preview as a mention. E.g: + +.. code-block:: js + + user.mention(); // something like <@3245982345035> + +This is mainly used internally by the API to correct mentions when sending messages, however you can use it. + +.. note:: You can also just concatenate a User object with strings to get the mention code, as the `toString()` method points to this. This is useful when sending messages. + +equals(object) +~~~~~~~~~~~~~~ + +Returns a `Boolean` depending on whether the User's ID (``user.id``) equals the object's ID (``object.id``). You should **always**, always use this if you want to compare users. **NEVER** do ``user1 == user2``. + +equalsStrict(object) +~~~~~~~~~~~~~~~~~~~~ + +Sees if the supplied object has the same username, ID, avatar and discriminator of the user. Mainly used internally. Returns a `Boolean` depending on the result. diff --git a/docs/index.rst b/docs/index.rst index c0e0451a6..afcd0cfd1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -29,8 +29,9 @@ Contents: :maxdepth: 2 :caption: Documentation - docs_client docs_resolvable + docs_client + docs_user diff --git a/docs/vars.rst b/docs/vars.rst index 60e2bc533..a0b315c9a 100644 --- a/docs/vars.rst +++ b/docs/vars.rst @@ -1,4 +1,4 @@ -.. _User : #user +.. _User : ./docs_user.html .. _ready : #ready .. _Server : #server .. _Channel : #channel