fix: shard imports

This commit is contained in:
grey-cat-1908 2022-04-22 08:38:45 +03:00
parent e539528e71
commit 725432162d
4 changed files with 20 additions and 14 deletions

View file

@ -9,10 +9,10 @@ from .rest import RESTApp
from .core.gateway import GatewayBotInfo
from .models.guild.channel import Channel, ChannelType, channel_types_for_converting
from .models import User, Guild, Activity
from .models.app import Shard
from .models.app.shard import Shard
from .models.app.intents import Intents
from .utils.snowflake import Snowflake
from .utils import APIModelBase
from .utils.api_model import APIModelBase
from .utils.logging import init_logging
from .utils.types import Coro
from .utils.waiters import WaiterMgr

View file

@ -78,6 +78,7 @@ class Gateway:
self.listeners = listeners
self._last_send = 0
self._max_connect_retries = 5
self.auth = {
"token": self.client._token,
@ -100,8 +101,10 @@ class Gateway:
self._buffer: bytearray = bytearray()
async def connect(self) -> None:
try:
self.ws = await self.__session.ws_connect(
"wss://gateway.discord.gg/?v=10&encoding=json&compress=zlib-stream"
"wss://gateway.discord.gg/?v=10&encoding=json&compress=zlib-stream",
timeout=30.0
)
_logger.debug("(Shard %s) Starting...", self.shard_id)
@ -112,6 +115,10 @@ class Gateway:
await self.send_identify()
self.loop.create_task(self.receive())
await self.check_heartbeating()
except (aiohttp.ClientConnectionError, asyncio.TimeoutError) as exc:
_logger.error("(Shard %s) Connecting failed!", self.shard_id)
raise exc
async def check_heartbeating(self):
while self.not_closed:

View file

@ -1,7 +1,7 @@
# Copyright MelisaDev 2022 - Present
# Full MIT License can be found in `LICENSE.txt` at the project root.
from .app import Shard, Intents
from .app import Intents
from .guild import *
from .user import *
from .message import *

View file

@ -2,4 +2,3 @@
# Full MIT License can be found in `LICENSE.txt` at the project root.
from .intents import Intents
from .shard import Shard