Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion discord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import asyncio
import datetime
import inspect
import logging
from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -2052,7 +2053,7 @@ async def on_ready():
The coroutine passed is not actually a coroutine.
"""

if not asyncio.iscoroutinefunction(coro):
if not inspect.iscoroutinefunction(coro):
raise TypeError('event registered must be a coroutine function')

setattr(self, coro.__name__, coro)
Expand Down
6 changes: 3 additions & 3 deletions discord/ext/commands/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from __future__ import annotations


import asyncio

Check failure on line 28 in discord/ext/commands/bot.py

View workflow job for this annotation

GitHub Actions / check 3.x

Import "asyncio" is not accessed (reportUnusedImport)
import collections
import collections.abc
import inspect
Expand Down Expand Up @@ -581,7 +581,7 @@
TypeError
The coroutine passed is not actually a coroutine.
"""
if not asyncio.iscoroutinefunction(coro):
if not inspect.iscoroutinefunction(coro):
raise TypeError('The pre-invoke hook must be a coroutine.')

self._before_invoke = coro
Expand Down Expand Up @@ -618,7 +618,7 @@
TypeError
The coroutine passed is not actually a coroutine.
"""
if not asyncio.iscoroutinefunction(coro):
if not inspect.iscoroutinefunction(coro):
raise TypeError('The post-invoke hook must be a coroutine.')

self._after_invoke = coro
Expand Down Expand Up @@ -654,7 +654,7 @@
"""
name = func.__name__ if name is MISSING else name

if not asyncio.iscoroutinefunction(func):
if not inspect.iscoroutinefunction(func):
raise TypeError('Listeners must be coroutines')

if name in self.extra_events:
Expand Down Expand Up @@ -1220,7 +1220,7 @@

if callable(prefix):
# self will be a Bot or AutoShardedBot
ret = await discord.utils.maybe_coroutine(prefix, self, message) # type: ignore

Check warning on line 1223 in discord/ext/commands/bot.py

View workflow job for this annotation

GitHub Actions / check 3.x

Unnecessary "# type: ignore" comment (reportUnnecessaryTypeIgnoreComment)

if not isinstance(ret, str):
try:
Expand Down
8 changes: 4 additions & 4 deletions discord/ext/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def __init__(
/,
**kwargs: Unpack[_CommandKwargs],
) -> None:
if not asyncio.iscoroutinefunction(func):
if not inspect.iscoroutinefunction(func):
raise TypeError('Callback must be a coroutine.')

name = kwargs.get('name') or func.__name__
Expand Down Expand Up @@ -1102,7 +1102,7 @@ def error(self, coro: Error[CogT, ContextT], /) -> Error[CogT, ContextT]:
The coroutine passed is not actually a coroutine.
"""

if not asyncio.iscoroutinefunction(coro):
if not inspect.iscoroutinefunction(coro):
raise TypeError('The error handler must be a coroutine.')

self.on_error: Error[CogT, Any] = coro
Expand Down Expand Up @@ -1140,7 +1140,7 @@ def before_invoke(self, coro: Hook[CogT, ContextT], /) -> Hook[CogT, ContextT]:
TypeError
The coroutine passed is not actually a coroutine.
"""
if not asyncio.iscoroutinefunction(coro):
if not inspect.iscoroutinefunction(coro):
raise TypeError('The pre-invoke hook must be a coroutine.')

self._before_invoke = coro
Expand Down Expand Up @@ -1171,7 +1171,7 @@ def after_invoke(self, coro: Hook[CogT, ContextT], /) -> Hook[CogT, ContextT]:
TypeError
The coroutine passed is not actually a coroutine.
"""
if not asyncio.iscoroutinefunction(coro):
if not inspect.iscoroutinefunction(coro):
raise TypeError('The post-invoke hook must be a coroutine.')

self._after_invoke = coro
Expand Down
Loading