Content-Length: 454636 | pFad | http://github.com/interactions-py/interactions.py/commit/164e01fa82380e3eb481da50573cd3d2d7d785a0

91 fix!: Channels typehinted to TYPE_ALL_CHANNEL instead of BaseChannel … · interactions-py/interactions.py@164e01f · GitHub
Skip to content

Commit 164e01f

Browse files
authored
fix!: Channels typehinted to TYPE_ALL_CHANNEL instead of BaseChannel in Events classes (#1538)
1 parent 4283a96 commit 164e01f

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

Diff for: interactions/api/events/discord.py

+23-19
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ async def an_event_handler(event: ChannelCreate):
2020
2121
"""
2222

23-
from typing import TYPE_CHECKING, List, Sequence, Union, Optional
23+
from typing import TYPE_CHECKING, List, Optional, Sequence, Union
2424

2525
import attrs
2626

2727
import interactions.models
28-
from interactions.api.events.base import GuildEvent, BaseEvent
28+
from interactions.api.events.base import BaseEvent, GuildEvent
2929
from interactions.client.const import Absent
3030
from interactions.client.utils.attr_utils import docs
3131
from interactions.models.discord.snowflake import to_snowflake
@@ -99,30 +99,34 @@ async def an_event_handler(event: ChannelCreate):
9999

100100

101101
if TYPE_CHECKING:
102-
from interactions.models.discord.guild import Guild, GuildIntegration
103-
from interactions.models.discord.channel import BaseChannel, TYPE_THREAD_CHANNEL, VoiceChannel
104-
from interactions.models.discord.message import Message
105-
from interactions.models.discord.timestamp import Timestamp
106-
from interactions.models.discord.user import Member, User, BaseUser
107-
from interactions.models.discord.snowflake import Snowflake_Type
108102
from interactions.models.discord.activity import Activity
103+
from interactions.models.discord.app_perms import ApplicationCommandPermission
104+
from interactions.models.discord.auto_mod import AutoModerationAction, AutoModRule
105+
from interactions.models.discord.channel import (
106+
TYPE_ALL_CHANNEL,
107+
TYPE_THREAD_CHANNEL,
108+
VoiceChannel,
109+
)
109110
from interactions.models.discord.emoji import CustomEmoji, PartialEmoji
111+
from interactions.models.discord.guild import Guild, GuildIntegration
112+
from interactions.models.discord.message import Message
113+
from interactions.models.discord.reaction import Reaction
110114
from interactions.models.discord.role import Role
115+
from interactions.models.discord.scheduled_event import ScheduledEvent
116+
from interactions.models.discord.snowflake import Snowflake_Type
117+
from interactions.models.discord.stage_instance import StageInstance
111118
from interactions.models.discord.sticker import Sticker
119+
from interactions.models.discord.timestamp import Timestamp
120+
from interactions.models.discord.user import BaseUser, Member, User
112121
from interactions.models.discord.voice_state import VoiceState
113-
from interactions.models.discord.stage_instance import StageInstance
114-
from interactions.models.discord.auto_mod import AutoModerationAction, AutoModRule
115-
from interactions.models.discord.reaction import Reaction
116-
from interactions.models.discord.app_perms import ApplicationCommandPermission
117-
from interactions.models.discord.scheduled_event import ScheduledEvent
118122

119123

120124
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
121125
class AutoModExec(BaseEvent):
122126
"""Dispatched when an auto modation action is executed"""
123127

124128
execution: "AutoModerationAction" = attrs.field(repr=False, metadata=docs("The executed auto mod action"))
125-
channel: "BaseChannel" = attrs.field(repr=False, metadata=docs("The channel the action was executed in"))
129+
channel: "TYPE_ALL_CHANNEL" = attrs.field(repr=False, metadata=docs("The channel the action was executed in"))
126130
guild: "Guild" = attrs.field(repr=False, metadata=docs("The guild the action was executed in"))
127131

128132

@@ -164,18 +168,18 @@ class ApplicationCommandPermissionsUpdate(BaseEvent):
164168
class ChannelCreate(BaseEvent):
165169
"""Dispatched when a channel is created."""
166170

167-
channel: "BaseChannel" = attrs.field(repr=False, metadata=docs("The channel this event is dispatched from"))
171+
channel: "TYPE_ALL_CHANNEL" = attrs.field(repr=False, metadata=docs("The channel this event is dispatched from"))
168172

169173

170174
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
171175
class ChannelUpdate(BaseEvent):
172176
"""Dispatched when a channel is updated."""
173177

174-
before: "BaseChannel" = attrs.field(
178+
before: "TYPE_ALL_CHANNEL" = attrs.field(
175179
repr=False,
176180
)
177181
"""Channel before this event. MISSING if it was not cached before"""
178-
after: "BaseChannel" = attrs.field(
182+
after: "TYPE_ALL_CHANNEL" = attrs.field(
179183
repr=False,
180184
)
181185
"""Channel after this event"""
@@ -226,7 +230,7 @@ class ThreadListSync(BaseEvent):
226230
repr=False,
227231
)
228232
"""The parent channel ids whose threads are being synced. If omitted, then threads were synced for the entire guild. This array may contain channel_ids that have no active threads as well, so you know to clear that data."""
229-
threads: List["BaseChannel"] = attrs.field(
233+
threads: List["TYPE_ALL_CHANNEL"] = attrs.field(
230234
repr=False,
231235
)
232236
"""all active threads in the given channels that the current user can access"""
@@ -618,7 +622,7 @@ class TypingStart(BaseEvent):
618622
repr=False,
619623
)
620624
"""The user who started typing"""
621-
channel: "BaseChannel" = attrs.field(
625+
channel: "TYPE_ALL_CHANNEL" = attrs.field(
622626
repr=False,
623627
)
624628
"""The channel typing is in"""

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/interactions-py/interactions.py/commit/164e01fa82380e3eb481da50573cd3d2d7d785a0

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy