diff --git a/composer.json b/composer.json index 7e12b99..a767546 100644 --- a/composer.json +++ b/composer.json @@ -23,17 +23,17 @@ "spatie/laravel-package-tools": "^1.16" }, "require-dev": { - "laravel/pint": "^1.14", - "nunomaduro/collision": "^8.1.1||^7.10.0", - "larastan/larastan": "^2.9", - "orchestra/testbench": "^9.0.0||^8.22.0", - "pestphp/pest": "^2.34", + "laravel/pint": "^1.20", + "nunomaduro/collision": "^8.5.0||^7.10.0", + "larastan/larastan": "^2.9.14", + "orchestra/testbench": "^9.9.0||^8.22.0", + "pestphp/pest": "^2.36", "pestphp/pest-plugin-arch": "^2.7", - "pestphp/pest-plugin-laravel": "^2.3", - "phpstan/extension-installer": "^1.3", - "phpstan/phpstan-deprecation-rules": "^1.1", - "phpstan/phpstan-phpunit": "^1.3", - "spatie/laravel-ray": "^1.35" + "pestphp/pest-plugin-laravel": "^2.4", + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan-deprecation-rules": "^1.2.1", + "phpstan/phpstan-phpunit": "^1.4.2", + "spatie/laravel-ray": "^1.39.1" }, "autoload": { "psr-4": { diff --git a/config/discord-interactions.php b/config/discord-interactions.php index 641f02e..d56de6f 100644 --- a/config/discord-interactions.php +++ b/config/discord-interactions.php @@ -10,7 +10,7 @@ 'middleware' => [ 'before' => [ - //ThrottleRequests::class, + // ThrottleRequests::class, ], 'after' => [ diff --git a/src/Discord.php b/src/Discord.php index 962c777..f5879e8 100755 --- a/src/Discord.php +++ b/src/Discord.php @@ -12,6 +12,7 @@ use Plytas\Discord\Data\DiscordInteraction; use Plytas\Discord\Data\DiscordMessage; use Plytas\Discord\Data\DiscordRole; +use Plytas\Discord\Data\DiscordUser; use Plytas\Discord\Exceptions\InvalidConfigurationException; readonly class Discord @@ -101,6 +102,11 @@ public function openDirectMessageChannel(string $userId): Response return $this->client->asJson()->post('/users/@me/channels', ['recipient_id' => $userId]); } + public function getUser(string $userId): DiscordUser + { + return DiscordUser::from($this->client->get("/users/{$userId}")->json()); + } + public function getGuild(string $guildId): DiscordGuild { return DiscordGuild::from($this->client->get("/guilds/{$guildId}")->json()); diff --git a/src/DiscordComponentRegistry.php b/src/DiscordComponentRegistry.php index 240ab92..054b380 100644 --- a/src/DiscordComponentRegistry.php +++ b/src/DiscordComponentRegistry.php @@ -64,7 +64,7 @@ public function handle(DiscordInteraction $interaction): DiscordResponse $componentHandler = self::$componentHandlers[$componentId] ?? null; if ($componentHandler === null) { - return $interaction->pong(); //Maybe acknowledge the interaction + return $interaction->pong(); // Maybe acknowledge the interaction } if (! is_a($componentHandler, DiscordComponentHandler::class, true)) { diff --git a/src/Facades/Discord.php b/src/Facades/Discord.php index 511c78f..54b0b53 100644 --- a/src/Facades/Discord.php +++ b/src/Facades/Discord.php @@ -11,6 +11,7 @@ use Plytas\Discord\Data\DiscordInteraction; use Plytas\Discord\Data\DiscordMessage; use Plytas\Discord\Data\DiscordRole; +use Plytas\Discord\Data\DiscordUser; /** * @method static Response createCommand(DiscordApplicationCommand $command) @@ -20,6 +21,7 @@ * @method static Response updateMessage(string $channelId, string $messageId, DiscordMessage $message) * @method static Response deleteMessage(string $channelId, string $messageId) * @method static Response openDirectMessageChannel(string $userId) + * @method static DiscordUser getUser(string $userId) * @method static DiscordGuild getGuild(string $guildId) * @method static Collection getChannels(string $guildId) * @method static Collection getRoles(string $guildId)