-
-
Notifications
You must be signed in to change notification settings - Fork 249
User
SQKo edited this page Dec 9, 2023
·
5 revisions
Users are part of Bot client. See Member for Guild Member object.
use Discord\Parts\User\User;A user is a general discord user that is not attached to a guild.
Your BOT must share Guild with the User
Change 123123123123123123 below with the User ID you want to retrieve
Cached, synchronous (i.e. loadAllMembers option is true):
$user = $discord->users->get('id', '123123123123123123');Cached User can be also retrieved from related objects:
-
Application
$user = $application->user;the application owner -
Ban
$user = $ban->user;the banned user -
Audit Log Entry
$user = $entry->user;user who made the changes -
Guild
$user = $guild->owner;the guild owner -
Invite
$user = $invite->inviter;user who created the invite -
Member
$user = $member->user;user of the member -
Message
$user = $message->author;author of the message -
Webhook
$user = $webhook->user;user who created the webhook
If the code above returns null, you may need to fetch it first (Promise, synchronous):
$discord->users->fetch('123123123123123123')->then(function (User $user) {
// ...
})->done();Note: This wiki is currently Work In Progress. Consider reading the docs instead.
- Application Command (Slash based)
Command Client (Message based)
- Activity
- Application
- Guild
- Private Channel
- User
Components
-
ActionRow
- Buttons
- Option (commands)
- SelectMenu
- TextInput
Builders