Client - discord-php/DiscordPHP GitHub Wiki
Client is your Discord BOT.
use Discord\Parts\User\Client;
The client is the main interface for the client. Most calls on the main class are forwarded here.
Accessing client properties and methods can be done simply with the $discord object.
Saves the client Part. Call this function after you are modifying the client attributes to apply the change.
function save() : ExtendedPromiseInterface
API Documentation: https://discord.com/developers/docs/resources/user#modify-current-user
Return
- ExtendedPromiseInterface
Example
$discord->save()->then(function () {
echo 'Bot data updated!';
})->done();
Sets the Bot avatar.
function setAvatar(string $filepath) : bool
Return
-
bool
true
on success
Example
$discord->setAvatar('/path/to/file');
// To apply the avatar change in Discord:
$discord->save();
-
Guild Repository
$discord->guilds
-
Private Channel Repository
$discord->private_channels
-
User Repository
$discord->users
$discord->username = 'NewBotName';
// To apply the name change in discord server:
$discord->save();