Skip to content

Commit 11a32b1

Browse files
committed
fix attribute errors
1 parent c58fb51 commit 11a32b1

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

discord/client.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def _get_state(self, **options: Any) -> ConnectionState:
320320
handlers=self._handlers,
321321
hooks=self._hooks,
322322
http=self.http,
323-
loop=self.loop,
323+
loop=self._loop,
324324
**options,
325325
)
326326

@@ -839,7 +839,12 @@ async def start(self, token: str, *, reconnect: bool = True) -> None:
839839
await self.login(token)
840840
await self.connect(reconnect=reconnect)
841841

842-
def run(self, token: str, *, reconnect: bool = True) -> None:
842+
def run(
843+
self,
844+
token: str,
845+
*,
846+
reconnect: bool = True,
847+
) -> None:
843848
"""A blocking call that abstracts away the event loop
844849
initialisation from you.
845850

discord/state.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
CS = TypeVar("CS", bound="ConnectionState")
9696
Channel = Union[GuildChannel, VocalGuildChannel, PrivateChannel, PartialMessageable]
9797

98+
MISSING = utils.MISSING
99+
98100

99101
class ChunkRequest:
100102
def __init__(
@@ -167,10 +169,10 @@ def __init__(
167169
handlers: dict[str, Callable],
168170
hooks: dict[str, Callable],
169171
http: HTTPClient,
170-
loop: asyncio.AbstractEventLoop,
172+
loop: asyncio.AbstractEventLoop | None,
171173
**options: Any,
172174
) -> None:
173-
self.loop: asyncio.AbstractEventLoop = loop
175+
self.loop: asyncio.AbstractEventLoop = loop or MISSING
174176
self.http: HTTPClient = http
175177
self.max_messages: int | None = options.get("max_messages", 1000)
176178
if self.max_messages is not None and self.max_messages <= 0:

0 commit comments

Comments
 (0)