-
-
Notifications
You must be signed in to change notification settings - Fork 248
Discord
SQKo edited this page Sep 7, 2021
·
31 revisions
Discord is the main object of your Discord BOT Application
Construct the DiscordPHP BOT instance
$discord = new Discord([
'token' => 'bot-token',
]);Return
- Discord the bot instance
Close the DiscordPHP Bot client
$discord->close();Allows access to the part/repository factory. Return
- Part the bot Part Factory
- Repository the bot Repository Factory
Gets a channel by its snowflake ID.
$channel = $discord->getChannel('012345678910111213');Return
- Channel the channel or private channel part
Gets the factory.
$factory = $discord->getFactory();Return
- Factory the bot Factory object
Gets the HTTP client.
$httpClient = $discord->getHttpClient();Return
- Http the bot Http object
Gets the logger being used.
$logger = $discord->getLogger();Return
- LoggerInterface the Logger interface
Gets the loop being used by the bot client.
$loop = $discord->getLoop();Return
- LoopInterface the bot Loop interface
Gets the bot voice client from a guild ID. Returns null if there is no voice client.
$voiceClient = $discord->getVoiceClient('012345678910111213');Return
- VoiceClient the bot Voice Client
-
nullthe bot has no Voice Client
joinVoiceChannel(Channel $channel[, bool $mute = false ][, bool $deaf = true ][, LoggerInterface|null $logger = null ][, bool $check = true ])
Joins a voice channel.
$discord->joinVoiceChannel($channel);Return
- PromiseInterface the promise when bot has joined the voice channel
Starts the bot ReactPHP event loop.
// Should be placed at bottom of the script
$discord->run();updatePresence([Activity|null $activity = null ][, bool $idle = false ][, string $status = 'online' ][, bool $afk = false ])
Updates the bot clients presence. See Activity
$activity = new Activity($discord, [
'name' => 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
'type' => Activity::TYPE_WATCHING
]);
$discord->updatePresence($activity);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