Skip to content

Commit

Permalink
Merge pull request #2 from Plytas/nullable-avatar
Browse files Browse the repository at this point in the history
Allow nullable user avatar
  • Loading branch information
Plytas authored Jun 26, 2024
2 parents e897767 + 5974951 commit 5d44423
Show file tree
Hide file tree
Showing 26 changed files with 30 additions and 57 deletions.
3 changes: 1 addition & 2 deletions src/Components/ActionRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ class ActionRow extends Data implements DiscordComponent
public function __construct(
/** @var Collection<int, DiscordComponent> */
public Collection $components = new Collection(),
) {
}
) {}

public static function new(): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Components/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public function __construct(
public ?bool $disabled = null,
public ?string $url = null,
public ButtonStyle $style = ButtonStyle::Primary,
) {
}
) {}

public static function new(): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Components/SelectOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public function __construct(
public ?string $description = null,
public ?DiscordEmoji $emoji = null,
public ?bool $default = null,
) {
}
) {}

public static function new(string $label, string $value): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Components/StringSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public function __construct(
public ?int $min_values = 1,
public ?int $max_values = 1,
public ?bool $disabled = false,
) {
}
) {}

public static function new(string $custom_id): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Components/TextInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public function __construct(
public ?int $min_length = null,
public ?int $max_length = null,
public TextInputStyle $style = TextInputStyle::Short,
) {
}
) {}

public static function new(string $custom_id, string $label): self
{
Expand Down
4 changes: 1 addition & 3 deletions src/Contracts/DiscordComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

namespace Plytas\Discord\Contracts;

interface DiscordComponent
{
}
interface DiscordComponent {}
3 changes: 1 addition & 2 deletions src/Data/DiscordApplicationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public function __construct(
public ?string $description = null,
/** @var Collection<int, DiscordApplicationCommandOption> */
public ?Collection $options = null,
) {
}
) {}

public static function new(string $name, CommandType $type): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Data/DiscordApplicationCommandOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public function __construct(
public ?string $description = null,
/** @var Collection<int, DiscordApplicationCommandOption> */
public ?Collection $options = null,
) {
}
) {}

public static function new(string $name, CommandOptionType $type): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Data/DiscordChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ public function __construct(
public string $guild_id,
public ?string $parent_id,
public int $position,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Data/DiscordEmoji.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ class DiscordEmoji extends Data
{
public function __construct(
public string $name,
) {
}
) {}

public static function new(string $name): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Data/DiscordInteraction.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public function __construct(
private ?DiscordApplicationCommand $applicationCommand = null,
private ?DiscordMessageComponent $messageComponent = null,
private ?DiscordModalComponent $modalComponent = null,
) {
}
) {}

public function pong(): DiscordResponse
{
Expand Down
3 changes: 1 addition & 2 deletions src/Data/DiscordMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ class DiscordMember extends Data
{
public function __construct(
public ?DiscordUser $user = null,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Data/DiscordMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public function __construct(
public Collection $embeds = new Collection(),
/** @var Collection<int, DiscordComponent> */
public Collection $components = new Collection(),
) {
}
) {}

public static function new(): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Data/DiscordMessageComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ public function __construct(
* @var array<int, string>
*/
public ?array $values,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Data/DiscordMessageEmbed.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public function __construct(
public int|EmbedColor $color = EmbedColor::Default,
/** @var Collection<int, DiscordMessageEmbedField> */
public Collection $fields = new Collection(),
) {
}
) {}

public static function new(): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Data/DiscordMessageEmbedField.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ public function __construct(
public string $name,
public string $value,
public bool $inline = false,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Data/DiscordModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public function __construct(
public string $title,
/** @var Collection<int, DiscordComponent> */
public Collection $components = new Collection(),
) {
}
) {}

public static function new(string $custom_id, string $title): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Data/DiscordModalActionRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ public function __construct(
public ComponentType $type,
/** @var Collection<int, DiscordModalTextInput> */
public Collection $components,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Data/DiscordModalComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ public function __construct(
public string $custom_id,
/** @var Collection<int, DiscordModalActionRow> */
public Collection $components,
) {
}
) {}

/**
* @return Collection<string, DiscordModalTextInput>
Expand Down
3 changes: 1 addition & 2 deletions src/Data/DiscordModalTextInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ public function __construct(
public string $custom_id,
public string $value,
public ComponentType $type,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Data/DiscordResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class DiscordResponse extends Data
public function __construct(
public ResponseType $type,
public Data|Optional $data,
) {
}
) {}

public static function pong(): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Data/DiscordRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ public function __construct(
public string $name,
public ?string $description,
public int $color,
) {
}
) {}

public function colorToHex(): string
{
Expand Down
11 changes: 5 additions & 6 deletions src/Data/DiscordUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ public function __construct(
public string $id,
public string $username,
public string $discriminator,
public string $global_name,
public string $avatar,
public bool $bot = false,
public bool $system = false,
) {
}
public ?string $global_name = null,
public ?string $avatar = null,
public ?bool $bot = false,
public ?bool $system = false,
) {}
}
3 changes: 1 addition & 2 deletions src/Events/DiscordCommandInteractionEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ class DiscordCommandInteractionEvent

public function __construct(
public DiscordInteraction $interaction
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/DiscordMessageComponentInteractionEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ class DiscordMessageComponentInteractionEvent

public function __construct(
public DiscordInteraction $interaction
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/DiscordModalInteractionEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ class DiscordModalInteractionEvent

public function __construct(
public DiscordInteraction $interaction
) {
}
) {}
}

0 comments on commit 5d44423

Please sign in to comment.