Skip to content

Commit

Permalink
fix: remove erroneous pyi file messing up client typehints (#1749)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstreaTSS authored Jan 16, 2025
1 parent dea3c79 commit 337c204
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 21 deletions.
3 changes: 3 additions & 0 deletions interactions/api/events/processors/_template.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 0 additions & 14 deletions interactions/api/events/processors/_template.pyi

This file was deleted.

10 changes: 5 additions & 5 deletions interactions/api/events/processors/auto_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
2 changes: 1 addition & 1 deletion interactions/api/events/processors/integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion interactions/api/events/processors/voice_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 337c204

Please sign in to comment.