From 337c204ae05651485511462a998411eb56ad7394 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Thu, 16 Jan 2025 02:15:56 -0500 Subject: [PATCH] fix: remove erroneous pyi file messing up client typehints (#1749) --- interactions/api/events/processors/_template.py | 3 +++ interactions/api/events/processors/_template.pyi | 14 -------------- interactions/api/events/processors/auto_mod.py | 10 +++++----- interactions/api/events/processors/integrations.py | 2 +- interactions/api/events/processors/voice_events.py | 2 +- 5 files changed, 10 insertions(+), 21 deletions(-) delete mode 100644 interactions/api/events/processors/_template.pyi diff --git a/interactions/api/events/processors/_template.py b/interactions/api/events/processors/_template.py index 2d8c57f0d..7174ce6d0 100644 --- a/interactions/api/events/processors/_template.py +++ b/interactions/api/events/processors/_template.py @@ -1,6 +1,7 @@ import asyncio import functools import inspect +import logging from typing import TYPE_CHECKING, Callable, Coroutine from interactions.client.const import Absent, MISSING, AsyncCallable @@ -40,7 +41,9 @@ class EventMixinTemplate: cache: "GlobalCache" dispatch: Callable[["BaseEvent"], None] + fetch_members: bool _init_interactions: Callable[[], Coroutine] + logger: logging.Logger synchronise_interactions: Callable[[], Coroutine] _user: ClientUser _guild_event: asyncio.Event diff --git a/interactions/api/events/processors/_template.pyi b/interactions/api/events/processors/_template.pyi deleted file mode 100644 index 3a4e70c55..000000000 --- a/interactions/api/events/processors/_template.pyi +++ /dev/null @@ -1,14 +0,0 @@ -from typing import Callable - -from interactions import Client -from interactions.client.const import Absent, AsyncCallable - -class Processor: - callback: AsyncCallable - event_name: str - def __init__(self, callback: AsyncCallable, name: str) -> None: ... - @classmethod - def define(cls, event_name: Absent[str] = ...) -> Callable[[AsyncCallable], "Processor"]: ... - -class EventMixinTemplate(Client): - def __init__(self) -> None: ... diff --git a/interactions/api/events/processors/auto_mod.py b/interactions/api/events/processors/auto_mod.py index dfee26c2d..d97851caf 100644 --- a/interactions/api/events/processors/auto_mod.py +++ b/interactions/api/events/processors/auto_mod.py @@ -15,24 +15,24 @@ class AutoModEvents(EventMixinTemplate): @Processor.define() async def _raw_auto_moderation_action_execution(self, event: "RawGatewayEvent") -> None: action = AutoModerationAction.from_dict(event.data.copy(), self) - channel = self.get_channel(event.data.get("channel_id")) - guild = self.get_guild(event.data["guild_id"]) + channel = self.cache.get_channel(event.data.get("channel_id")) + guild = self.cache.get_guild(event.data["guild_id"]) self.dispatch(events.AutoModExec(action, channel, guild)) @Processor.define() async def raw_auto_moderation_rule_create(self, event: "RawGatewayEvent") -> None: rule = AutoModRule.from_dict(event.data, self) - guild = self.get_guild(event.data["guild_id"]) + guild = self.cache.get_guild(event.data["guild_id"]) self.dispatch(events.AutoModCreated(guild, rule)) @Processor.define() async def raw_auto_moderation_rule_update(self, event: "RawGatewayEvent") -> None: rule = AutoModRule.from_dict(event.data, self) - guild = self.get_guild(event.data["guild_id"]) + guild = self.cache.get_guild(event.data["guild_id"]) self.dispatch(events.AutoModUpdated(guild, rule)) @Processor.define() async def raw_auto_moderation_rule_delete(self, event: "RawGatewayEvent") -> None: rule = AutoModRule.from_dict(event.data, self) - guild = self.get_guild(event.data["guild_id"]) + guild = self.cache.get_guild(event.data["guild_id"]) self.dispatch(events.AutoModDeleted(guild, rule)) diff --git a/interactions/api/events/processors/integrations.py b/interactions/api/events/processors/integrations.py index 12615dcdb..9aebf379e 100644 --- a/interactions/api/events/processors/integrations.py +++ b/interactions/api/events/processors/integrations.py @@ -23,7 +23,7 @@ async def _raw_application_command_permissions_update(self, event: "RawGatewayEv command_id = to_snowflake(event.data["id"]) application_id = to_snowflake(event.data["application_id"]) - if guild := self.get_guild(guild_id): + if guild := self.cache.get_guild(guild_id): if guild.permissions: if command_id not in guild.command_permissions: guild.command_permissions[command_id] = CommandPermissions( diff --git a/interactions/api/events/processors/voice_events.py b/interactions/api/events/processors/voice_events.py index ea243a414..77d3dbfc2 100644 --- a/interactions/api/events/processors/voice_events.py +++ b/interactions/api/events/processors/voice_events.py @@ -13,7 +13,7 @@ class VoiceEvents(EventMixinTemplate): @Processor.define() async def _on_raw_voice_state_update(self, event: "RawGatewayEvent") -> None: - if str(event.data["user_id"]) == str(self.user.id): + if str(event.data["user_id"]) == str(self._user.id): # User is the bot itself before = copy.copy(self.cache.get_bot_voice_state(event.data["guild_id"])) or None after = await self.cache.place_voice_state_data(event.data, update_cache=False)