Skip to content

Commit

Permalink
Add Application EmojiRepository
Browse files Browse the repository at this point in the history
  • Loading branch information
valzargaming committed Sep 21, 2024
1 parent c96f679 commit 2799375
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 15 deletions.
33 changes: 18 additions & 15 deletions src/Discord/Discord.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -322,7 +325,7 @@ class Discord
/**
* The cache configuration.
*
* @var CacheConfig
* @var CacheConfig[]
*/
protected $cacheConfig;

Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Parts/User/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -71,6 +72,7 @@ class Client extends Part
* {@inheritDoc}
*/
protected $repositories = [
'emojis' => EmojiRepository::class,
'guilds' => GuildRepository::class,
'private_channels' => PrivateChannelRepository::class,
'users' => UserRepository::class,
Expand Down
49 changes: 49 additions & 0 deletions src/Discord/Repository/EmojiRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

/*
* This file is a part of the DiscordPHP project.
*
* Copyright (c) 2015-present David Cole <david.cole1340@gmail.com>
*
* 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;
}

0 comments on commit 2799375

Please sign in to comment.