2021-01-25 17:28:59 +01:00
|
|
|
import functools
|
|
|
|
|
|
|
|
from discord.ext import commands
|
|
|
|
|
|
|
|
from tuxbot.core.utils.functions.extra import ContextPlus
|
|
|
|
|
|
|
|
|
2021-01-22 10:22:39 +01:00
|
|
|
def upper_first(string: str) -> str:
|
|
|
|
return "".join(string[0].upper() + string[1:])
|
2021-01-25 17:28:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
def typing(func):
|
|
|
|
@functools.wraps(func)
|
|
|
|
async def wrapped(*args, **kwargs):
|
|
|
|
context = (
|
|
|
|
args[0]
|
|
|
|
if isinstance(args[0], (commands.Context, ContextPlus))
|
|
|
|
else args[1]
|
|
|
|
)
|
|
|
|
|
|
|
|
async with context.typing():
|
|
|
|
await func(*args, **kwargs)
|
|
|
|
|
|
|
|
return wrapped
|