Skip to content

Commit 4ccf9b1

Browse files
authored
update all references to the Emoji class
1 parent 0381a6e commit 4ccf9b1

File tree

20 files changed

+101
-101
lines changed

20 files changed

+101
-101
lines changed

discord/abc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ async def _edit(
513513
except KeyError:
514514
pass
515515
else:
516-
if isinstance(default_reaction_emoji, _EmojiTag): # Emoji, PartialEmoji
516+
if isinstance(default_reaction_emoji, _EmojiTag): # GuildEmoji, PartialEmoji
517517
default_reaction_emoji = default_reaction_emoji._to_partial()
518518
elif isinstance(default_reaction_emoji, int):
519519
default_reaction_emoji = PartialEmoji(
@@ -523,7 +523,7 @@ async def _edit(
523523
default_reaction_emoji = PartialEmoji.from_str(default_reaction_emoji)
524524
else:
525525
raise InvalidArgument(
526-
"default_reaction_emoji must be of type: Emoji | int | str"
526+
"default_reaction_emoji must be of type: GuildEmoji | int | str"
527527
)
528528

529529
options["default_reaction_emoji"] = (
@@ -1792,7 +1792,7 @@ def can_send(self, *objects) -> bool:
17921792
"Message": "send_messages",
17931793
"Embed": "embed_links",
17941794
"File": "attach_files",
1795-
"Emoji": "use_external_emojis",
1795+
"GuildEmoji": "use_external_emojis",
17961796
"GuildSticker": "use_external_stickers",
17971797
}
17981798
# Can't use channel = await self._get_channel() since its async
@@ -1817,7 +1817,7 @@ def can_send(self, *objects) -> bool:
18171817
mapping.get(type(obj).__name__) or mapping[obj.__name__]
18181818
)
18191819

1820-
if type(obj).__name__ == "Emoji":
1820+
if type(obj).__name__ == "GuildEmoji":
18211821
if (
18221822
obj._to_partial().is_unicode_emoji
18231823
or obj.guild_id == channel.guild.id

discord/audit_logs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
import datetime
4848

4949
from . import abc
50-
from .emoji import Emoji
50+
from .emoji import GuildEmoji
5151
from .guild import Guild
5252
from .member import Member
5353
from .role import Role
@@ -617,7 +617,7 @@ def target(
617617
| User
618618
| Role
619619
| Invite
620-
| Emoji
620+
| GuildEmoji
621621
| StageInstance
622622
| GuildSticker
623623
| Thread
@@ -689,7 +689,7 @@ def _convert_target_invite(self, target_id: int) -> Invite:
689689
pass
690690
return obj
691691

692-
def _convert_target_emoji(self, target_id: int) -> Emoji | Object:
692+
def _convert_target_emoji(self, target_id: int) -> GuildEmoji | Object:
693693
return self._state.get_emoji(target_id) or Object(id=target_id)
694694

695695
def _convert_target_message(self, target_id: int) -> Member | User | None:

discord/channel.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
from . import utils
3434
from .asset import Asset
35-
from .emoji import Emoji
35+
from .emoji import GuildEmoji
3636
from .enums import (
3737
ChannelType,
3838
EmbeddedActivity,
@@ -143,7 +143,7 @@ def __init__(
143143
self.emoji = PartialEmoji.from_str(emoji)
144144
else:
145145
raise TypeError(
146-
"emoji must be a Emoji, PartialEmoji, or str and not"
146+
"emoji must be a GuildEmoji, PartialEmoji, or str and not"
147147
f" {emoji.__class__!r}"
148148
)
149149

@@ -1018,7 +1018,7 @@ class ForumChannel(_TextChannel):
10181018
The initial slowmode delay to set on newly created threads in this channel.
10191019
10201020
.. versionadded:: 2.3
1021-
default_reaction_emoji: Optional[:class:`str` | :class:`discord.Emoji`]
1021+
default_reaction_emoji: Optional[:class:`str` | :class:`discord.GuildEmoji`]
10221022
The default forum reaction emoji.
10231023
10241024
.. versionadded:: 2.5
@@ -1087,7 +1087,7 @@ async def edit(
10871087
default_auto_archive_duration: ThreadArchiveDuration = ...,
10881088
default_thread_slowmode_delay: int = ...,
10891089
default_sort_order: SortOrder = ...,
1090-
default_reaction_emoji: Emoji | int | str | None = ...,
1090+
default_reaction_emoji: GuildEmoji | int | str | None = ...,
10911091
available_tags: list[ForumTag] = ...,
10921092
require_tag: bool = ...,
10931093
overwrites: Mapping[Role | Member | Snowflake, PermissionOverwrite] = ...,
@@ -1138,10 +1138,10 @@ async def edit(self, *, reason=None, **options):
11381138
The default sort order type to use to order posts in this channel.
11391139
11401140
.. versionadded:: 2.3
1141-
default_reaction_emoji: Optional[:class:`discord.Emoji` | :class:`int` | :class:`str`]
1141+
default_reaction_emoji: Optional[:class:`discord.GuildEmoji` | :class:`int` | :class:`str`]
11421142
The default reaction emoji.
11431143
Can be a unicode emoji or a custom emoji in the forms:
1144-
:class:`Emoji`, snowflake ID, string representation (eg. '<a:emoji_name:emoji_id>').
1144+
:class:`GuildEmoji`, snowflake ID, string representation (eg. '<a:emoji_name:emoji_id>').
11451145
11461146
.. versionadded:: 2.5
11471147
available_tags: List[:class:`ForumTag`]

discord/components.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from .utils import MISSING, get_slots
3333

3434
if TYPE_CHECKING:
35-
from .emoji import Emoji
35+
from .emoji import GuildEmoji, AppEmoji
3636
from .types.components import ActionRow as ActionRowPayload
3737
from .types.components import ButtonComponent as ButtonComponentPayload
3838
from .types.components import Component as ComponentPayload
@@ -412,7 +412,7 @@ def __init__(
412412
label: str,
413413
value: str = MISSING,
414414
description: str | None = None,
415-
emoji: str | Emoji | PartialEmoji | None = None,
415+
emoji: str | GuildEmoji | AppEmoji | PartialEmoji | None = None,
416416
default: bool = False,
417417
) -> None:
418418
if len(label) > 100:
@@ -444,7 +444,7 @@ def __str__(self) -> str:
444444
return base
445445

446446
@property
447-
def emoji(self) -> str | Emoji | PartialEmoji | None:
447+
def emoji(self) -> str | GuildEmoji | AppEmoji | PartialEmoji | None:
448448
"""The emoji of the option, if available."""
449449
return self._emoji
450450

@@ -457,7 +457,7 @@ def emoji(self, value) -> None:
457457
value = value._to_partial()
458458
else:
459459
raise TypeError(
460-
"expected emoji to be str, Emoji, or PartialEmoji not"
460+
"expected emoji to be str, GuildEmoji, AppEmoji, or PartialEmoji, not"
461461
f" {value.__class__}"
462462
)
463463

discord/ext/commands/converter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,8 @@ async def convert(self, ctx: Context, argument: str) -> discord.Guild:
805805
return result
806806

807807

808-
class EmojiConverter(IDConverter[discord.Emoji]):
809-
"""Converts to a :class:`~discord.Emoji`.
808+
class EmojiConverter(IDConverter[discord.GuildEmoji]):
809+
"""Converts to a :class:`~discord.GuildEmoji`.
810810
811811
All lookups are done for the local guild first, if available. If that lookup
812812
fails, then it checks the client's global cache.
@@ -821,7 +821,7 @@ class EmojiConverter(IDConverter[discord.Emoji]):
821821
Raise :exc:`.EmojiNotFound` instead of generic :exc:`.BadArgument`
822822
"""
823823

824-
async def convert(self, ctx: Context, argument: str) -> discord.Emoji:
824+
async def convert(self, ctx: Context, argument: str) -> discord.GuildEmoji:
825825
match = self._get_id_match(argument) or re.match(
826826
r"<a?:\w{1,32}:([0-9]{15,20})>$", argument
827827
)
@@ -1111,7 +1111,7 @@ def is_generic_type(tp: Any, *, _GenericAlias: type = _GenericAlias) -> bool:
11111111
discord.Colour: ColourConverter,
11121112
discord.VoiceChannel: VoiceChannelConverter,
11131113
discord.StageChannel: StageChannelConverter,
1114-
discord.Emoji: EmojiConverter,
1114+
discord.GuildEmoji: EmojiConverter,
11151115
discord.PartialEmoji: PartialEmojiConverter,
11161116
discord.CategoryChannel: CategoryChannelConverter,
11171117
discord.ForumChannel: ForumChannelConverter,

discord/ext/pages/pagination.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class PaginatorButton(discord.ui.Button):
5454
label: :class:`str`
5555
The label shown on the button.
5656
Defaults to a capitalized version of ``button_type`` (e.g. "Next", "Prev", etc.)
57-
emoji: Union[:class:`str`, :class:`discord.Emoji`, :class:`discord.PartialEmoji`]
57+
emoji: Union[:class:`str`, :class:`discord.GuildEmoji`, :class:`discord.AppEmoji`, :class:`discord.PartialEmoji`]
5858
The emoji shown on the button in front of the label.
5959
disabled: :class:`bool`
6060
Whether to initially show the button as disabled.
@@ -72,7 +72,7 @@ def __init__(
7272
self,
7373
button_type: str,
7474
label: str = None,
75-
emoji: str | discord.Emoji | discord.PartialEmoji = None,
75+
emoji: str | discord.GuildEmoji | discord.AppEmoji | discord.PartialEmoji = None,
7676
style: discord.ButtonStyle = discord.ButtonStyle.green,
7777
disabled: bool = False,
7878
custom_id: str = None,
@@ -89,7 +89,7 @@ def __init__(
8989
)
9090
self.button_type = button_type
9191
self.label = label if label or emoji else button_type.capitalize()
92-
self.emoji: str | discord.Emoji | discord.PartialEmoji = emoji
92+
self.emoji: str | discord.GuildEmoji | discord.AppEmoji | discord.PartialEmoji = emoji
9393
self.style = style
9494
self.disabled = disabled
9595
self.loop_label = self.label if not loop_label else loop_label
@@ -242,7 +242,7 @@ class PageGroup:
242242
Also used as the SelectOption value.
243243
description: Optional[:class:`str`]
244244
The description shown on the corresponding PaginatorMenu dropdown option.
245-
emoji: Union[:class:`str`, :class:`discord.Emoji`, :class:`discord.PartialEmoji`]
245+
emoji: Union[:class:`str`, :class:`discord.GuildEmoji`, :class:`discord.AppEmoji`, :class:`discord.PartialEmoji`]
246246
The emoji shown on the corresponding PaginatorMenu dropdown option.
247247
default: Optional[:class:`bool`]
248248
Whether the page group should be the default page group initially shown when the paginator response is sent.
@@ -278,7 +278,7 @@ def __init__(
278278
pages: list[str] | list[Page] | list[list[discord.Embed] | discord.Embed],
279279
label: str,
280280
description: str | None = None,
281-
emoji: str | discord.Emoji | discord.PartialEmoji = None,
281+
emoji: str | discord.GuildEmoji | discord.AppEmoji | discord.PartialEmoji = None,
282282
default: bool | None = None,
283283
show_disabled: bool | None = None,
284284
show_indicator: bool | None = None,
@@ -294,7 +294,7 @@ def __init__(
294294
):
295295
self.label = label
296296
self.description: str | None = description
297-
self.emoji: str | discord.Emoji | discord.PartialEmoji = emoji
297+
self.emoji: str | discord.GuildEmoji | discord.AppEmoji | discord.PartialEmoji = emoji
298298
self.pages: list[str] | list[list[discord.Embed] | discord.Embed] = pages
299299
self.default: bool | None = default
300300
self.show_disabled = show_disabled

discord/flags.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ def emojis_and_stickers(self):
769769
770770
This also corresponds to the following attributes and classes in terms of cache:
771771
772-
- :class:`Emoji`
772+
- :class:`GuildEmoji`
773773
- :class:`GuildSticker`
774774
- :meth:`Client.get_emoji`
775775
- :meth:`Client.get_sticker`

discord/guild.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
from .channel import *
4747
from .channel import _guild_channel_factory, _threaded_guild_channel_factory
4848
from .colour import Colour
49-
from .emoji import Emoji, PartialEmoji, _EmojiTag
49+
from .emoji import GuildEmoji, PartialEmoji, _EmojiTag
5050
from .enums import (
5151
AuditLogAction,
5252
AutoModEventType,
@@ -161,7 +161,7 @@ class Guild(Hashable):
161161
----------
162162
name: :class:`str`
163163
The guild name.
164-
emojis: Tuple[:class:`Emoji`, ...]
164+
emojis: Tuple[:class:`GuildEmoji`, ...]
165165
All emojis that the guild owns.
166166
stickers: Tuple[:class:`GuildSticker`, ...]
167167
All stickers that the guild owns.
@@ -476,7 +476,7 @@ def _from_data(self, guild: GuildPayload) -> None:
476476
self._roles[role.id] = role
477477

478478
self.mfa_level: MFALevel = guild.get("mfa_level")
479-
self.emojis: tuple[Emoji, ...] = tuple(
479+
self.emojis: tuple[GuildEmoji, ...] = tuple(
480480
map(lambda d: state.store_emoji(self, d), guild.get("emojis", []))
481481
)
482482
self.stickers: tuple[GuildSticker, ...] = tuple(
@@ -1404,7 +1404,7 @@ async def create_forum_channel(
14041404
slowmode_delay: int = MISSING,
14051405
nsfw: bool = MISSING,
14061406
overwrites: dict[Role | Member, PermissionOverwrite] = MISSING,
1407-
default_reaction_emoji: Emoji | int | str = MISSING,
1407+
default_reaction_emoji: GuildEmoji | int | str = MISSING,
14081408
) -> ForumChannel:
14091409
"""|coro|
14101410
@@ -1446,10 +1446,10 @@ async def create_forum_channel(
14461446
To mark the channel as NSFW or not.
14471447
reason: Optional[:class:`str`]
14481448
The reason for creating this channel. Shows up on the audit log.
1449-
default_reaction_emoji: Optional[:class:`Emoji` | :class:`int` | :class:`str`]
1449+
default_reaction_emoji: Optional[:class:`GuildEmoji` | :class:`int` | :class:`str`]
14501450
The default reaction emoji.
14511451
Can be a unicode emoji or a custom emoji in the forms:
1452-
:class:`Emoji`, snowflake ID, string representation (eg. '<a:emoji_name:emoji_id>').
1452+
:class:`GuildEmoji`, snowflake ID, string representation (eg. '<a:emoji_name:emoji_id>').
14531453
14541454
.. versionadded:: v2.5
14551455
@@ -1502,7 +1502,7 @@ async def create_forum_channel(
15021502
options["nsfw"] = nsfw
15031503

15041504
if default_reaction_emoji is not MISSING:
1505-
if isinstance(default_reaction_emoji, _EmojiTag): # Emoji, PartialEmoji
1505+
if isinstance(default_reaction_emoji, _EmojiTag): # GuildEmoji, PartialEmoji
15061506
default_reaction_emoji = default_reaction_emoji._to_partial()
15071507
elif isinstance(default_reaction_emoji, int):
15081508
default_reaction_emoji = PartialEmoji(
@@ -1512,7 +1512,7 @@ async def create_forum_channel(
15121512
default_reaction_emoji = PartialEmoji.from_str(default_reaction_emoji)
15131513
else:
15141514
raise InvalidArgument(
1515-
"default_reaction_emoji must be of type: Emoji | int | str"
1515+
"default_reaction_emoji must be of type: GuildEmoji | int | str"
15161516
)
15171517

15181518
options["default_reaction_emoji"] = (
@@ -2662,10 +2662,10 @@ async def delete_sticker(
26622662
"""
26632663
await self._state.http.delete_guild_sticker(self.id, sticker.id, reason)
26642664

2665-
async def fetch_emojis(self) -> list[Emoji]:
2665+
async def fetch_emojis(self) -> list[GuildEmoji]:
26662666
r"""|coro|
26672667
2668-
Retrieves all custom :class:`Emoji`\s from the guild.
2668+
Retrieves all custom :class:`GuildEmoji`\s from the guild.
26692669
26702670
.. note::
26712671
@@ -2678,16 +2678,16 @@ async def fetch_emojis(self) -> list[Emoji]:
26782678
26792679
Returns
26802680
--------
2681-
List[:class:`Emoji`]
2681+
List[:class:`GuildEmoji`]
26822682
The retrieved emojis.
26832683
"""
26842684
data = await self._state.http.get_all_custom_emojis(self.id)
2685-
return [Emoji(guild=self, state=self._state, data=d) for d in data]
2685+
return [GuildEmoji(guild=self, state=self._state, data=d) for d in data]
26862686

2687-
async def fetch_emoji(self, emoji_id: int, /) -> Emoji:
2687+
async def fetch_emoji(self, emoji_id: int, /) -> GuildEmoji:
26882688
"""|coro|
26892689
2690-
Retrieves a custom :class:`Emoji` from the guild.
2690+
Retrieves a custom :class:`GuildEmoji` from the guild.
26912691
26922692
.. note::
26932693
@@ -2701,7 +2701,7 @@ async def fetch_emoji(self, emoji_id: int, /) -> Emoji:
27012701
27022702
Returns
27032703
-------
2704-
:class:`Emoji`
2704+
:class:`GuildEmoji`
27052705
The retrieved emoji.
27062706
27072707
Raises
@@ -2712,7 +2712,7 @@ async def fetch_emoji(self, emoji_id: int, /) -> Emoji:
27122712
An error occurred fetching the emoji.
27132713
"""
27142714
data = await self._state.http.get_custom_emoji(self.id, emoji_id)
2715-
return Emoji(guild=self, state=self._state, data=data)
2715+
return GuildEmoji(guild=self, state=self._state, data=data)
27162716

27172717
async def create_custom_emoji(
27182718
self,
@@ -2721,10 +2721,10 @@ async def create_custom_emoji(
27212721
image: bytes,
27222722
roles: list[Role] = MISSING,
27232723
reason: str | None = None,
2724-
) -> Emoji:
2724+
) -> GuildEmoji:
27252725
r"""|coro|
27262726
2727-
Creates a custom :class:`Emoji` for the guild.
2727+
Creates a custom :class:`GuildEmoji` for the guild.
27282728
27292729
There is currently a limit of 50 static and animated emojis respectively per guild,
27302730
unless the guild has the ``MORE_EMOJI`` feature which extends the limit to 200.
@@ -2753,7 +2753,7 @@ async def create_custom_emoji(
27532753
27542754
Returns
27552755
--------
2756-
:class:`Emoji`
2756+
:class:`GuildEmoji`
27572757
The created emoji.
27582758
"""
27592759

@@ -2769,7 +2769,7 @@ async def delete_emoji(
27692769
) -> None:
27702770
"""|coro|
27712771
2772-
Deletes the custom :class:`Emoji` from the guild.
2772+
Deletes the custom :class:`GuildEmoji` from the guild.
27732773
27742774
You must have :attr:`~Permissions.manage_emojis` permission to
27752775
do this.

0 commit comments

Comments
 (0)