(LCtx): Complete util migration.

This commit is contained in:
2022-01-20 09:26:09 +02:00
parent 49c8ea5e02
commit f504177e93
4 changed files with 14 additions and 16 deletions

View File

@@ -1,8 +1,8 @@
import discord import discord
from .module import module from .module import module
from wards import guild_admin
from bot.cmdClient.checks import in_guild, is_owner from bot.cmdClient.checks import in_guild, is_owner
from settings.user_settings import UserSettings from settings.user_settings import UserSettings
from LionContext import LionContext
from .webhook import on_dbl_vote from .webhook import on_dbl_vote
from .utils import lion_loveemote from .utils import lion_loveemote
@@ -14,7 +14,7 @@ from .utils import lion_loveemote
group="Bot Admin", group="Bot Admin",
) )
@is_owner() @is_owner()
async def cmd_forcevote(ctx): async def cmd_forcevote(ctx: LionContext):
""" """
Usage``: Usage``:
{prefix}forcevote {prefix}forcevote
@@ -42,7 +42,7 @@ async def cmd_forcevote(ctx):
aliases=('topgg', 'topggvote', 'upvote') aliases=('topgg', 'topggvote', 'upvote')
) )
@in_guild() @in_guild()
async def cmd_vote(ctx): async def cmd_vote(ctx: LionContext):
""" """
Usage``: Usage``:
{prefix}vote {prefix}vote
@@ -67,7 +67,7 @@ async def cmd_vote(ctx):
group="Personal Settings", group="Personal Settings",
desc="Turn on/off boost reminders." desc="Turn on/off boost reminders."
) )
async def cmd_remind_vote(ctx): async def cmd_remind_vote(ctx: LionContext):
""" """
Usage: Usage:
`{prefix}vote_reminder on` `{prefix}vote_reminder on`

View File

@@ -1,6 +1,6 @@
import asyncio import asyncio
import discord import discord
from cmdClient import Context from LionContext import LionContext as Context
from cmdClient.lib import SafeCancellation from cmdClient.lib import SafeCancellation
from data import tables from data import tables

View File

@@ -1,10 +1,8 @@
import asyncio import asyncio
import discord import discord
from LionContext import LionContext from LionContext import LionContext as Context
from cmdClient.lib import UserCancelled, ResponseTimedOut from cmdClient.lib import UserCancelled, ResponseTimedOut
import datetime
from cmdClient import lib
from .lib import paginate_list from .lib import paginate_list
# TODO: Interactive locks # TODO: Interactive locks
@@ -21,7 +19,7 @@ async def discord_shield(coro):
pass pass
@LionContext.util @Context.util
async def cancellable(ctx, msg, add_reaction=True, cancel_message=None, timeout=300): async def cancellable(ctx, msg, add_reaction=True, cancel_message=None, timeout=300):
""" """
Add a cancellation reaction to the given message. Add a cancellation reaction to the given message.
@@ -64,7 +62,7 @@ async def cancellable(ctx, msg, add_reaction=True, cancel_message=None, timeout=
return task return task
@LionContext.util @Context.util
async def listen_for(ctx, allowed_input=None, timeout=120, lower=True, check=None): async def listen_for(ctx, allowed_input=None, timeout=120, lower=True, check=None):
""" """
Listen for a one of a particular set of input strings, Listen for a one of a particular set of input strings,
@@ -116,7 +114,7 @@ async def listen_for(ctx, allowed_input=None, timeout=120, lower=True, check=Non
return message return message
@LionContext.util @Context.util
async def selector(ctx, header, select_from, timeout=120, max_len=20): async def selector(ctx, header, select_from, timeout=120, max_len=20):
""" """
Interactive routine to prompt the `ctx.author` to select an item from a list. Interactive routine to prompt the `ctx.author` to select an item from a list.
@@ -216,7 +214,7 @@ async def selector(ctx, header, select_from, timeout=120, max_len=20):
return result return result
@LionContext.util @Context.util
async def pager(ctx, pages, locked=True, start_at=0, add_cancel=False, **kwargs): async def pager(ctx, pages, locked=True, start_at=0, add_cancel=False, **kwargs):
""" """
Shows the user each page from the provided list `pages` one at a time, Shows the user each page from the provided list `pages` one at a time,
@@ -373,7 +371,7 @@ async def _pager(ctx, out_msg, pages, locked, start_at, add_cancel, **kwargs):
pass pass
@LionContext.util @Context.util
async def input(ctx, msg="", timeout=120): async def input(ctx, msg="", timeout=120):
""" """
Listen for a response in the current channel, from ctx.author. Listen for a response in the current channel, from ctx.author.
@@ -415,7 +413,7 @@ async def input(ctx, msg="", timeout=120):
return result return result
@LionContext.util @Context.util
async def ask(ctx, msg, timeout=30, use_msg=None, del_on_timeout=False): async def ask(ctx, msg, timeout=30, use_msg=None, del_on_timeout=False):
""" """
Ask ctx.author a yes/no question. Ask ctx.author a yes/no question.

View File

@@ -1,9 +1,9 @@
import asyncio import asyncio
import discord import discord
from cmdClient import Context from LionContext import LionContext as Context
from cmdClient.lib import InvalidContext, UserCancelled, ResponseTimedOut, SafeCancellation from cmdClient.lib import InvalidContext, UserCancelled, ResponseTimedOut, SafeCancellation
from . import interactive from . import interactive as _interactive
@Context.util @Context.util