mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-12-03 14:02:19 +00:00
Add Interaction.client property
This commit is contained in:
@@ -30,7 +30,21 @@ import copy
|
||||
import datetime
|
||||
import itertools
|
||||
import logging
|
||||
from typing import Dict, Optional, TYPE_CHECKING, Union, Callable, Any, List, TypeVar, Coroutine, Sequence, Tuple, Deque
|
||||
from typing import (
|
||||
Dict,
|
||||
Generic,
|
||||
Optional,
|
||||
TYPE_CHECKING,
|
||||
Union,
|
||||
Callable,
|
||||
Any,
|
||||
List,
|
||||
TypeVar,
|
||||
Coroutine,
|
||||
Sequence,
|
||||
Tuple,
|
||||
Deque,
|
||||
)
|
||||
import weakref
|
||||
import inspect
|
||||
|
||||
@@ -84,6 +98,8 @@ if TYPE_CHECKING:
|
||||
T = TypeVar('T')
|
||||
Channel = Union[GuildChannel, VocalGuildChannel, PrivateChannel, PartialMessageable]
|
||||
|
||||
ClientT = TypeVar('ClientT', bound='Client')
|
||||
|
||||
|
||||
class ChunkRequest:
|
||||
def __init__(
|
||||
@@ -143,10 +159,10 @@ async def logging_coroutine(coroutine: Coroutine[Any, Any, T], *, info: str) ->
|
||||
_log.exception('Exception occurred during %s', info)
|
||||
|
||||
|
||||
class ConnectionState:
|
||||
class ConnectionState(Generic[ClientT]):
|
||||
if TYPE_CHECKING:
|
||||
_get_websocket: Callable[..., DiscordWebSocket]
|
||||
_get_client: Callable[..., Client]
|
||||
_get_client: Callable[..., ClientT]
|
||||
_parsers: Dict[str, Callable[[Dict[str, Any]], None]]
|
||||
|
||||
def __init__(
|
||||
@@ -1471,7 +1487,7 @@ class ConnectionState:
|
||||
return Message(state=self, channel=channel, data=data)
|
||||
|
||||
|
||||
class AutoShardedConnectionState(ConnectionState):
|
||||
class AutoShardedConnectionState(ConnectionState[ClientT]):
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
self.shard_ids: Union[List[int], range] = []
|
||||
|
||||
Reference in New Issue
Block a user