diff --git a/src/Discord/Discord.php b/src/Discord/Discord.php index e21f99330..d18576eac 100644 --- a/src/Discord/Discord.php +++ b/src/Discord/Discord.php @@ -21,6 +21,7 @@ use Discord\Http\Endpoint; use Discord\Http\Http; use Discord\Parts\Channel\Channel; +use Discord\Parts\Guild\Emoji; use Discord\Parts\Guild\Guild; use Discord\Parts\OAuth\Application; use Discord\Parts\Part; @@ -29,6 +30,7 @@ use Discord\Parts\User\Member; use Discord\Parts\User\User; use Discord\Repository\AbstractRepository; +use Discord\Repository\EmojiRepository; use Discord\Repository\GuildRepository; use Discord\Repository\PrivateChannelRepository; use Discord\Repository\UserRepository; @@ -61,20 +63,21 @@ * * @version 10.0.0 * - * @property string $id The unique identifier of the client. - * @property string $username The username of the client. - * @property string $password The password of the client (if they have provided it). - * @property string $email The email of the client. - * @property bool $verified Whether the client has verified their email. - * @property string $avatar The avatar URL of the client. - * @property string $avatar_hash The avatar hash of the client. - * @property string $discriminator The unique discriminator of the client. - * @property bool $bot Whether the client is a bot. - * @property User $user The user instance of the client. - * @property Application $application The OAuth2 application of the bot. - * @property GuildRepository $guilds - * @property PrivateChannelRepository $private_channels - * @property UserRepository $users + * @property string $id The unique identifier of the client. + * @property string $username The username of the client. + * @property string $password The password of the client (if they have provided it). + * @property string $email The email of the client. + * @property bool $verified Whether the client has verified their email. + * @property string $avatar The avatar URL of the client. + * @property string $avatar_hash The avatar hash of the client. + * @property string $discriminator The unique discriminator of the client. + * @property bool $bot Whether the client is a bot. + * @property User $user The user instance of the client. + * @property Application $application The OAuth2 application of the bot. + * @property GuildRepository $guilds + * @property PrivateChannelRepository $private_channels + * @property UserRepository $users + * @property EmojiRepository $emojis */ class Discord { @@ -322,7 +325,7 @@ class Discord /** * The cache configuration. * - * @var CacheConfig + * @var CacheConfig[] */ protected $cacheConfig; diff --git a/src/Discord/Parts/User/Client.php b/src/Discord/Parts/User/Client.php index b1845aec3..3748674c4 100644 --- a/src/Discord/Parts/User/Client.php +++ b/src/Discord/Parts/User/Client.php @@ -15,6 +15,7 @@ use Discord\Http\Endpoint; use Discord\Parts\OAuth\Application; use Discord\Parts\Part; +use Discord\Repository\EmojiRepository; use Discord\Repository\GuildRepository; use Discord\Repository\PrivateChannelRepository; use Discord\Repository\UserRepository; @@ -40,6 +41,7 @@ * @property User $user The user instance of the client. * @property Application $application The OAuth2 application of the bot. * + * @property EmojiRepository $emojis * @property GuildRepository $guilds * @property PrivateChannelRepository $private_channels * @property UserRepository $users @@ -71,6 +73,7 @@ class Client extends Part * {@inheritDoc} */ protected $repositories = [ + 'emojis' => EmojiRepository::class, 'guilds' => GuildRepository::class, 'private_channels' => PrivateChannelRepository::class, 'users' => UserRepository::class, diff --git a/src/Discord/Repository/EmojiRepository.php b/src/Discord/Repository/EmojiRepository.php new file mode 100644 index 000000000..18c8250de --- /dev/null +++ b/src/Discord/Repository/EmojiRepository.php @@ -0,0 +1,49 @@ + + * + * This file is subject to the MIT license that is bundled + * with this source code in the LICENSE.md file. + */ + +namespace Discord\Repository; + +use Discord\Http\Endpoint; +use Discord\Parts\Guild\Emoji; +use Discord\Repository\AbstractRepository; + +/** + * Contains emojis of an application. + * + * @see Emoji + * @see \Discord\Parts\User\Client + * + * @since 4.0.2 + * + * @method Emoji|null get(string $discrim, $key) + * @method Emoji|null pull(string|int $key, $default = null) + * @method Emoji|null first() + * @method Emoji|null last() + * @method Emoji|null find(callable $callback) + */ +class EmojiRepository extends AbstractRepository +{ + /** + * {@inheritDoc} + */ + protected $endpoints = [ + 'all' => Endpoint::APPLICATION_EMOJIS, + 'get' => Endpoint::APPLICATION_EMOJI, + 'create' => Endpoint::APPLICATION_EMOJIS, + 'delete' => Endpoint::APPLICATION_EMOJI, + 'update' => Endpoint::APPLICATION_EMOJI, + ]; + + /** + * {@inheritDoc} + */ + protected $class = Emoji::class; +}