Skip to content

Commit c3d0d6f

Browse files
committed
feat(application_commands): annotated ConnectionState.http
1 parent f306606 commit c3d0d6f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

discord/state.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2424
DEALINGS IN THE SOFTWARE.
2525
"""
26+
from __future__ import annotations
2627

2728
import asyncio
2829
from collections import deque, OrderedDict
@@ -36,7 +37,7 @@
3637
import gc
3738

3839
import os
39-
from typing import Union
40+
from typing import Union, TYPE_CHECKING
4041

4142
from .guild import Guild
4243
from .activity import BaseActivity
@@ -60,6 +61,10 @@
6061
from .interactions import BaseInteraction, InteractionType
6162

6263

64+
if TYPE_CHECKING:
65+
from .http import HTTPClient
66+
67+
6368
class ChunkRequest:
6469
def __init__(self, guild_id, loop, resolver, *, cache=True):
6570
self.guild_id = guild_id
@@ -114,7 +119,7 @@ async def logging_coroutine(coroutine, *, info):
114119
class ConnectionState:
115120
def __init__(self, *, dispatch, handlers, hooks, syncer, http, loop, **options):
116121
self.loop = loop
117-
self.http = http
122+
self.http: HTTPClient = http
118123
self.max_messages = options.get('max_messages', 1000)
119124
if self.max_messages is not None and self.max_messages <= 0:
120125
self.max_messages = 1000
@@ -1313,10 +1318,10 @@ def get_channel(self, id):
13131318
if channel is not None:
13141319
return channel
13151320

1316-
13171321
def create_message(self, *, channel, data):
13181322
return Message(state=self, channel=channel, data=data)
13191323

1324+
13201325
class AutoShardedConnectionState(ConnectionState):
13211326
def __init__(self, *args, **kwargs):
13221327
super().__init__(*args, **kwargs)

0 commit comments

Comments
 (0)