Skip to content

Commit cea4f78

Browse files
authored
fix: account for BaseChannel for channel mentions (#1480)
1 parent d7bcfba commit cea4f78

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

interactions/models/discord/message.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from interactions.client.utils.attr_converters import timestamp_converter
2525
from interactions.client.utils.serializer import dict_filter_none
2626
from interactions.client.utils.text_utils import mentions
27-
from interactions.models.discord.channel import BaseChannel
27+
from interactions.models.discord.channel import BaseChannel, GuildChannel
2828
from interactions.models.discord.emoji import process_emoji_req_format
2929
from interactions.models.discord.file import UPLOADABLE_TYPE
3030
from interactions.models.discord.embed import process_embeds
@@ -109,7 +109,7 @@ def _process_dict(cls, data: Dict[str, Any], _) -> Dict[str, Any]:
109109

110110
@attrs.define(eq=False, order=False, hash=False, kw_only=True)
111111
class ChannelMention(DiscordObject):
112-
guild_id: "Snowflake_Type" = attrs.field(
112+
guild_id: "Snowflake_Type | None" = attrs.field(
113113
repr=False,
114114
)
115115
"""id of the guild containing the channel"""
@@ -466,7 +466,7 @@ def _process_dict(cls, data: dict, client: "Client") -> dict: # noqa: C901
466466
if channel_id not in found_ids and (channel := client.get_channel(channel_id)):
467467
channel_data = {
468468
"id": channel.id,
469-
"guild_id": channel._guild_id,
469+
"guild_id": channel._guild_id if isinstance(channel, GuildChannel) else None,
470470
"type": channel.type,
471471
"name": channel.name,
472472
}

0 commit comments

Comments
 (0)