aboutsummaryrefslogtreecommitdiff
path: root/discord/client.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-04-04 07:24:42 -0400
committerRapptz <[email protected]>2021-04-04 07:24:42 -0400
commit59aa1a0e5f785116f2d21204e755071c38daccca (patch)
treedeaa572ebbee35be87440f7ad3db8ec79cf63d26 /discord/client.py
parentConvert two missing places to f-strings (diff)
downloaddiscord.py-59aa1a0e5f785116f2d21204e755071c38daccca.tar.xz
discord.py-59aa1a0e5f785116f2d21204e755071c38daccca.zip
Remove asyncio.Task subclass in preference to task names
Diffstat (limited to 'discord/client.py')
-rw-r--r--discord/client.py18
1 files changed, 1 insertions, 17 deletions
diff --git a/discord/client.py b/discord/client.py
index cf15bfed..b20406c2 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -92,22 +92,6 @@ def _cleanup_loop(loop):
log.info('Closing the event loop.')
loop.close()
-class _ClientEventTask(asyncio.Task):
- def __init__(self, original_coro, event_name, coro, *, loop):
- super().__init__(coro, loop=loop)
- self.__event_name = event_name
- self.__original_coro = original_coro
-
- def __repr__(self):
- info = [
- ('state', self._state.lower()),
- ('event', self.__event_name),
- ('coro', repr(self.__original_coro)),
- ]
- if self._exception is not None:
- info.append(('exception', repr(self._exception)))
- return '<ClientEventTask {}>'.format(' '.join('%s=%s' % t for t in info))
-
class Client:
r"""Represents a client connection that connects to Discord.
This class is used to interact with the Discord WebSocket and API.
@@ -350,7 +334,7 @@ class Client:
def _schedule_event(self, coro, event_name, *args, **kwargs):
wrapped = self._run_event(coro, event_name, *args, **kwargs)
# Schedules the task
- return _ClientEventTask(original_coro=coro, event_name=event_name, coro=wrapped, loop=self.loop)
+ return asyncio.create_task(wrapped, name=f'discord.py: {event_name}')
def dispatch(self, event, *args, **kwargs):
log.debug('Dispatching event %s', event)