diff --git a/docs/src/pages/api/07_permissions.md b/docs/src/pages/api/07_permissions.md index 726560761..b682f8dff 100644 --- a/docs/src/pages/api/07_permissions.md +++ b/docs/src/pages/api/07_permissions.md @@ -72,7 +72,7 @@ Represents permissions for text, voice, and stage instance channels. - `move_members` - `use_vad` - `manage_events` -- `start_embedded_activities` +- `use_embedded_activities` was `start_embedded_activities` #### Stage Instance Channel Permissions diff --git a/docs/src/pages/api/09_components.md b/docs/src/pages/api/09_components.md index 7e2461655..0453c6d1a 100644 --- a/docs/src/pages/api/09_components.md +++ b/docs/src/pages/api/09_components.md @@ -105,7 +105,7 @@ $select = SelectMenu::new() | ---------------------------------- | ------------------------------------------------------------------------------------------------------ | | `addOption($option)` | adds an option to the select menu. maximum 25 options per menu. options must have unique values. | | `removeOption($option)` | removes an option from the select menu. | -| `setPlaceholder($placeholder)` | sets a placeholder string to be displayed when nothing is selected. null to clear. max 100 characters. | +| `setPlaceholder($placeholder)` | sets a placeholder string to be displayed when nothing is selected. null to clear. max 150 characters. | | `setMinValues($min_values)` | the number of values which must be selected to submit the menu. between 0 and 25, default 1. | | `setMaxValues($max_values)` | the maximum number of values which can be selected. maximum 25, default 1. | | `setDisabled($disabled)` | sets whether the menu is disabled or not. | diff --git a/src/Discord/Builders/Components/SelectMenu.php b/src/Discord/Builders/Components/SelectMenu.php index 64df0eed3..14b0a2cd0 100644 --- a/src/Discord/Builders/Components/SelectMenu.php +++ b/src/Discord/Builders/Components/SelectMenu.php @@ -43,7 +43,7 @@ class SelectMenu extends Component private $options = []; /** - * Placeholder string to display if nothing is selected. Maximum 100 characters. + * Placeholder string to display if nothing is selected. Maximum 150 characters. * * @var string|null */ @@ -176,7 +176,7 @@ public function removeOption(Option $option): self /** * Sets the placeholder string to display if nothing is selected. - * Maximum 100 characters. Null to clear placeholder. + * Maximum 150 characters. Null to clear placeholder. * * @param string|null $placeholder * @@ -186,8 +186,8 @@ public function removeOption(Option $option): self */ public function setPlaceholder(?string $placeholder): self { - if (isset($placeholder) && strlen($placeholder) > 100) { - throw new \LengthException('Placeholder string must be less than or equal to 100 characters.'); + if (isset($placeholder) && poly_strlen($placeholder) > 150) { + throw new \LengthException('Placeholder string must be less than or equal to 150 characters.'); } $this->placeholder = $placeholder; diff --git a/src/Discord/Builders/Components/TextInput.php b/src/Discord/Builders/Components/TextInput.php index dcc87dc51..b195ee41f 100644 --- a/src/Discord/Builders/Components/TextInput.php +++ b/src/Discord/Builders/Components/TextInput.php @@ -221,7 +221,7 @@ public function setMaxLength(?int $max_length): self */ public function setPlaceholder(?string $placeholder): self { - if (isset($placeholder) && strlen($placeholder) > 100) { + if (isset($placeholder) && poly_strlen($placeholder) > 100) { throw new \LengthException('Placeholder string must be less than or equal to 100 characters.'); } diff --git a/src/Discord/Discord.php b/src/Discord/Discord.php index 6eee0b3e4..29cfd60aa 100644 --- a/src/Discord/Discord.php +++ b/src/Discord/Discord.php @@ -86,7 +86,7 @@ class Discord * * @var string Version. */ - public const VERSION = 'v7.0.4'; + public const VERSION = 'v7.0.5'; /** * The logger. @@ -332,6 +332,8 @@ public function __construct(array $options = []) $this->loop = $options['loop']; $this->logger = $options['logger']; + $this->logger->debug('Initializing DiscordPHP '.self::VERSION.' (DiscordPHP-Http: '.Http::VERSION.' & Gateway: v'.self::GATEWAY_VERSION.') on PHP '.PHP_VERSION); + $connector = new SocketConnector($this->loop, $options['socket_options']); $this->wsFactory = new Connector($this->loop, $connector); $this->handlers = new Handlers(); diff --git a/src/Discord/Parts/Channel/StageInstance.php b/src/Discord/Parts/Channel/StageInstance.php index 16d71a4bf..a8f646498 100644 --- a/src/Discord/Parts/Channel/StageInstance.php +++ b/src/Discord/Parts/Channel/StageInstance.php @@ -19,13 +19,14 @@ * * @see https://discord.com/developers/docs/resources/stage-instance#stage-instance-resource * - * @property string $id The unique identifier of the Stage Instance. - * @property string $guild_id The unique identifier of the guild that the stage instance associated to. - * @property Guild|null $guild The guild that the stage instance associated to. - * @property string $channel_id The id of the associated Stage channel. - * @property Channel $channel The channel that the stage instance associated to. - * @property string $topic The topic of the Stage instance (1-120 characters). - * @property int $privacy_level The privacy level of the Stage instance. + * @property string $id The unique identifier of the Stage Instance. + * @property string $guild_id The unique identifier of the guild that the stage instance associated to. + * @property Guild|null $guild The guild that the stage instance associated to. + * @property string $channel_id The id of the associated Stage channel. + * @property Channel $channel The channel that the stage instance associated to. + * @property string $topic The topic of the Stage instance (1-120 characters). + * @property int $privacy_level The privacy level of the Stage instance. + * @property string|null $guild_scheduled_event_id The id of the scheduled event. */ class StageInstance extends Part { @@ -43,6 +44,7 @@ class StageInstance extends Part 'topic', 'privacy_level', 'discoverable_disabled', + 'guild_scheduled_event_id', ]; /** diff --git a/src/Discord/Parts/Interactions/Request/Component.php b/src/Discord/Parts/Interactions/Request/Component.php index ed4016547..87fe75a2a 100644 --- a/src/Discord/Parts/Interactions/Request/Component.php +++ b/src/Discord/Parts/Interactions/Request/Component.php @@ -28,7 +28,7 @@ * @property Emoji|null $emoji Name, id, and animated. (Buttons) * @property string|null $url A url for link-style buttons. (Buttons) * @property object[]|null $options The choices in the select, max 25. (Select Menus) - * @property string|null $placeholder Custom placeholder text if nothing is selected, max 100 characters. (Select Menus, Text Inputs) + * @property string|null $placeholder Custom placeholder text if nothing is selected, max 150 characters. (Select Menus, Text Inputs) * @property int|null $min_values The minimum number of items that must be chosen; default 1, min 0, max 25. (Select Menus) * @property int|null $max_values The maximum number of items that can be chosen; default 1, max 25. (Select Menus) * @property ComponentRepository $components A list of child components. (Action Rows) diff --git a/src/Discord/Parts/Permissions/ChannelPermission.php b/src/Discord/Parts/Permissions/ChannelPermission.php index df222094d..b89e8576b 100644 --- a/src/Discord/Parts/Permissions/ChannelPermission.php +++ b/src/Discord/Parts/Permissions/ChannelPermission.php @@ -30,7 +30,7 @@ * @property bool $move_members * @property bool $use_vad * @property bool $manage_events - * @property bool $start_embedded_activities + * @property bool $start_embedded_activities @todo $use_embedded_activities * * @property bool $add_reactions * @property bool $send_messages diff --git a/src/Discord/Parts/Permissions/Permission.php b/src/Discord/Parts/Permissions/Permission.php index 69152376e..521776f65 100644 --- a/src/Discord/Parts/Permissions/Permission.php +++ b/src/Discord/Parts/Permissions/Permission.php @@ -59,7 +59,7 @@ abstract class Permission extends Part 'move_members' => 24, 'use_vad' => 25, 'manage_events' => 33, - 'start_embedded_activities' => 39, + 'start_embedded_activities' => 39, // @todo use_embedded_activities ]; /** @@ -199,6 +199,26 @@ protected function setBitwiseAttribute($bitwise) } } + /** + * @inheritdoc + * + * @todo replace start_embedded_activities in next major version + */ + protected function getUseEmbeddedActivitiesAttribute() + { + return $this->attributes['start_embedded_activities'] ?? null; + } + + /** + * @inheritdoc + * + * @todo replace start_embedded_activities in next major version + */ + protected function setUseEmbeddedActivitiesAttribute($value) + { + $this->attributes['start_embedded_activities'] = $value; + } + /** * @inheritdoc * diff --git a/src/Discord/Parts/Permissions/RolePermission.php b/src/Discord/Parts/Permissions/RolePermission.php index 737fc2278..a7374c6a7 100644 --- a/src/Discord/Parts/Permissions/RolePermission.php +++ b/src/Discord/Parts/Permissions/RolePermission.php @@ -30,7 +30,7 @@ * @property bool $move_members * @property bool $use_vad * @property bool $manage_events - * @property bool $start_embedded_activities + * @property bool $start_embedded_activities @todo $use_embedded_activities * * @property bool $add_reactions * @property bool $send_messages diff --git a/src/Discord/Parts/User/Member.php b/src/Discord/Parts/User/Member.php index 430d4385d..051174a15 100644 --- a/src/Discord/Parts/User/Member.php +++ b/src/Discord/Parts/User/Member.php @@ -313,7 +313,7 @@ public function getPermissions($channel = null): RolePermission if ($channel) { if ($channel instanceof Thread) { $channel = $this->guild->channels->get('id', $channel->parent_id); - } elseif (!($channel instanceof Channel)) { + } elseif (! ($channel instanceof Channel)) { throw new \InvalidArgumentException('$channel must be an instance of Channel, Thread or null.'); } } diff --git a/src/Discord/Parts/WebSockets/VoiceStateUpdate.php b/src/Discord/Parts/WebSockets/VoiceStateUpdate.php index 2564467ec..c2e5ece41 100644 --- a/src/Discord/Parts/WebSockets/VoiceStateUpdate.php +++ b/src/Discord/Parts/WebSockets/VoiceStateUpdate.php @@ -78,7 +78,7 @@ protected function getGuildAttribute(): ?Guild */ protected function getChannelAttribute(): ?Channel { - if (! $this->channel_id) { + if (! isset($this->attributes['channel_id'])) { return null; } diff --git a/src/Discord/Voice/VoiceClient.php b/src/Discord/Voice/VoiceClient.php index ac1de7e9a..e92ebf42e 100644 --- a/src/Discord/Voice/VoiceClient.php +++ b/src/Discord/Voice/VoiceClient.php @@ -326,21 +326,21 @@ class VoiceClient extends EventEmitter protected $dnsConfig; /** - * Silence Frame Remain Count + * Silence Frame Remain Count. * * @var int Amount of silence frames remaining. */ protected $silenceRemaining = 5; /** - * readopus Timer + * readopus Timer. * * @var TimerInterface Timer */ protected $readOpusTimer; /** - * Audio Buffer + * Audio Buffer. * * @var Buffer The Audio Buffer */ @@ -874,8 +874,8 @@ public function playDCAStream($stream): ExtendedPromiseInterface private function reset(): void { if ($this->readOpusTimer) { - $this->loop->cancelTimer($this->readOpusTimer); - $this->readOpusTimer = null; + $this->loop->cancelTimer($this->readOpusTimer); + $this->readOpusTimer = null; } $this->setSpeaking(false); @@ -1519,7 +1519,7 @@ private function insertSilence(): void { // https://discord.com/developers/docs/topics/voice-connections#voice-data-interpolation while ($this->silenceRemaining--) { - $this->sendBuffer(self::SILENCE_FRAME); + $this->sendBuffer(self::SILENCE_FRAME); } } }