Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the docs on the User class #194

Open
wants to merge 2 commits into
base: docs
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 84 additions & 3 deletions source/documentation.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ Removes a member from a server
#### Return value
Returns ``true`` on success

#### banMember
### banMember

```cpp
bool banMember(Snowflake<Server> serverID, Snowflake<User> userID);
Expand Down Expand Up @@ -1010,8 +1010,9 @@ Compares the ids of two messages
```cpp
struct User : public DiscordObject {
~User();
User();
User(const std::string * rawJSON);
User() = default;
User(const nonstd::string_view & json);
User(const json::Value& json);
```

Based on [the object with the same name from the api](https://discordapp.com/developers/docs/resources/user#user-object)
Expand All @@ -1035,6 +1036,86 @@ Compares the id of two Users
#### Return value
``true`` when the two Users have the same id

### Public Members
### ID

```cpp
Snowflake<Derived> ID;
```
Declared in the IdentifiableDiscordObject class (in ``discord_object_interface.h``) which the User class derives from
#### Value
The ``ID`` of that user object which can be compared to string literals/objects with the ``==`` and ``!=`` overloaded operators

#### Example
```cpp
void onMessage(SleepyDiscord::Message message) {
std::cout << ("someIDnum" == message.author.ID) << std::endl;
std::cout << message.author.ID.string() << std::endl;
}
```
In the example above ``message.author`` is a ``User`` object, we use the ``ID`` attribute, inherited from the ``IdentifiableDiscordObject`` class, which inturn is a ``Snowflake`` object. We first compare it to the string literal ``"someIDnum"`` by using the ``==``, on the next line we use the string() member method to convert it into a string.

### username
```cpp
std::string username;
```
Declared in the User class (in ``user.h``)
#### Value
The user's username, which may not be unique across the platform.

### discriminator
```cpp
std::string discriminator;
```
Declared in User class (in ``user.h``)
#### Value
The user's 4-digit discord-tag, e.g (some_user``#5432``).

### avatar
```cpp
std::string avatar;
```
Declared in User class (in ``user.h``)
#### Value
The user's avatar hash, base64 encoded jpeg image.
### bot
```cpp
bool bot = false;
```
Declared in User class (in ``user.h``)
#### Value
Whether the user belongs to an OAuth2 application.
### mfa_enabled
```cpp
bool mfa_enabled = false;
```
Declared in User class (in ``user.h``)
#### Value
Whether the user has two factor enabled on their account.
### verified
```cpp
bool verified = false;
```
Declared in User class (in ``user.h``)
#### Value
Whether the email on this account has been verified.
### email
```cpp
std::string email = "";
```
Declared in User class (in ``user.h``)
#### Value
The user's email.
### locale
```cpp
std::string locale = "";
```
Declared in User class (in ``user.h``)
#### Value
The user's chosen language.



# Voice
[For a step by step guild on using voice, go to here](voice.html).
[](TO DO Add examples for voice)
Expand Down