mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-12-04 22:42:21 +00:00
Move all async object creation to a proper initialisation point
This should make it so no object is created with another loop
This commit is contained in:
@@ -300,6 +300,9 @@ class ConnectionState:
|
||||
else:
|
||||
await coro(*args, **kwargs)
|
||||
|
||||
async def async_setup(self) -> None:
|
||||
pass
|
||||
|
||||
@property
|
||||
def self_id(self) -> Optional[int]:
|
||||
u = self.user
|
||||
@@ -1485,7 +1488,6 @@ class AutoShardedConnectionState(ConnectionState):
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
self.shard_ids: Union[List[int], range] = []
|
||||
self.shards_launched: asyncio.Event = asyncio.Event()
|
||||
|
||||
def _update_message_references(self) -> None:
|
||||
# self._messages won't be None when this is called
|
||||
@@ -1500,6 +1502,9 @@ class AutoShardedConnectionState(ConnectionState):
|
||||
# channel will either be a TextChannel, Thread or Object
|
||||
msg._rebind_cached_references(new_guild, channel) # type: ignore
|
||||
|
||||
async def async_setup(self) -> None:
|
||||
self.shards_launched: asyncio.Event = asyncio.Event()
|
||||
|
||||
async def chunker(
|
||||
self,
|
||||
guild_id: int,
|
||||
|
||||
Reference in New Issue
Block a user