aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/decorators.py10
-rw-r--r--bot/pagination.py2
2 files changed, 6 insertions, 6 deletions
diff --git a/bot/decorators.py b/bot/decorators.py
index ace9346f0..70482bfa4 100644
--- a/bot/decorators.py
+++ b/bot/decorators.py
@@ -3,7 +3,7 @@ import random
from asyncio import Lock, sleep
from contextlib import suppress
from functools import wraps
-from typing import Callable, Container, Union
+from typing import Any, Callable, Container, Optional, Union
from weakref import WeakValueDictionary
from discord import Colour, Embed
@@ -66,7 +66,7 @@ def without_role(*role_ids: int) -> Callable:
return commands.check(predicate)
-def locked() -> Union[Callable, None]:
+def locked() -> Callable:
"""
Allows the user to only run one instance of the decorated command at a time.
@@ -74,11 +74,11 @@ def locked() -> Union[Callable, None]:
This decorator has to go before (below) the `command` decorator.
"""
- def wrap(func: Callable) -> Union[Callable, None]:
+ def wrap(func: Callable) -> Callable:
func.__locks = WeakValueDictionary()
@wraps(func)
- async def inner(self: Callable, ctx: Context, *args, **kwargs) -> Union[Callable, None]:
+ async def inner(self: Callable, ctx: Context, *args, **kwargs) -> Optional[Any]:
lock = func.__locks.setdefault(ctx.author.id, Lock())
if lock.locked():
embed = Embed()
@@ -106,7 +106,7 @@ def redirect_output(destination_channel: int, bypass_roles: Container[int] = Non
"""
def wrap(func: Callable) -> Callable:
@wraps(func)
- async def inner(self: Callable, ctx: Context, *args, **kwargs) -> Callable:
+ async def inner(self: Callable, ctx: Context, *args, **kwargs) -> None:
if ctx.channel.id == destination_channel:
log.trace(f"Command {ctx.command.name} was invoked in destination_channel, not redirecting")
return await func(self, ctx, *args, **kwargs)
diff --git a/bot/pagination.py b/bot/pagination.py
index 10ef6c407..afdd6b905 100644
--- a/bot/pagination.py
+++ b/bot/pagination.py
@@ -303,7 +303,7 @@ class ImagePaginator(Paginator):
@classmethod
async def paginate(cls, pages: List[Tuple[str, str]], ctx: Context, embed: Embed,
prefix: str = "", suffix: str = "", timeout: int = 300,
- exception_on_empty_embed: bool = False):
+ exception_on_empty_embed: bool = False) -> Optional[Message]:
"""
Use a paginator and set of reactions to provide pagination over a set of title/image pairs.