-
Notifications
You must be signed in to change notification settings - Fork 238
Parts
Parts is the term used for the data structures inside Discord. All parts share a common set of attributes and methods.
Parts have a set list of fillable fields. If you attempt to set a field that is not accessible, it will not warn you.
To create a part object, you can use the new
syntax or the factory
method. For example, creating a Message
part:
$message = new Message($discord);
// or
$message = $discord->factory->create(Message::class);
Part attributes can be accessed similar to an object or like an array:
$message->content = 'hello!';
// or
$message['content'] = 'hello!';
echo $message->content;
// or
echo $message['content'];
The ->fill(array $attributes)
function takes an array of attributes to fill the part. If a field is found that is not 'fillable', it is skipped.
$message->fill([
'content' => 'hello!',
]);
The ->getRawAttributes()
function returns the array representation of the part.
$attributes = $message->getRawAttributes();
/**
* [
* "id" => "",
* "content" => "",
* // ...
* ]
*/
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