mirror of
https://github.com/myned/modufur.git
synced 2024-12-25 14:47:29 +00:00
Removed previous testing for lastcommand
This commit is contained in:
parent
293f2c6f5f
commit
5168c025c5
2 changed files with 12 additions and 16 deletions
|
@ -1094,9 +1094,6 @@ class MsG:
|
||||||
await ctx.send('**Request timed out**')
|
await ctx.send('**Request timed out**')
|
||||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||||
|
|
||||||
# tools.command_dict.setdefault(str(ctx.author.id), {}).update(
|
|
||||||
# {'command': ctx.command, 'args': ctx.args})
|
|
||||||
|
|
||||||
# @e621.error
|
# @e621.error
|
||||||
# async def e621_error(self, ctx, error):
|
# async def e621_error(self, ctx, error):
|
||||||
# if isinstance(error, exc.NSFW):
|
# if isinstance(error, exc.NSFW):
|
||||||
|
|
|
@ -25,33 +25,32 @@ youtube = None
|
||||||
|
|
||||||
tempfile.tempdir = os.getcwd()
|
tempfile.tempdir = os.getcwd()
|
||||||
|
|
||||||
command_dict = {}
|
|
||||||
|
|
||||||
|
|
||||||
class Utils:
|
class Utils:
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
@commands.command(name='last', aliases=['l', ','], brief='Reinvokes last command', description='Reinvokes previous command executed', hidden=True)
|
@commands.command(name='lastcommand', aliases=['last', 'l', ','], brief='Reinvokes last successful command', description='Executes last successfully executed command')
|
||||||
async def last_command(self, ctx):
|
async def last_command(self, ctx, arg='None'):
|
||||||
global command_dict
|
try:
|
||||||
|
context = u.last_commands[ctx.author.id]
|
||||||
|
|
||||||
if command_dict.get(str(ctx.author.id), {}).get('args', None) is not None:
|
if arg == 'show' or arg == 'sh' or arg == 's':
|
||||||
args = command_dict.get(str(ctx.author.id), {})['args']
|
await ctx.send(f'`{context.prefix}{context.invoked_with} {" ".join(context.args[2:])}`', delete_after=7)
|
||||||
print(command_dict)
|
else:
|
||||||
await ctx.invoke(command_dict.get(str(ctx.author.id), {}).get('command', None), args)
|
await ctx.invoke(context.command, *context.args[2:], **context.kwargs)
|
||||||
|
|
||||||
|
except KeyError:
|
||||||
|
await ctx.send('**No last command**', delete_after=7)
|
||||||
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||||
|
|
||||||
# Displays latency
|
# Displays latency
|
||||||
@commands.command(aliases=['p'], brief='Pong!', description='Returns latency from bot to Discord servers, not to user')
|
@commands.command(aliases=['p'], brief='Pong!', description='Returns latency from bot to Discord servers, not to user')
|
||||||
@checks.del_ctx()
|
@checks.del_ctx()
|
||||||
async def ping(self, ctx):
|
async def ping(self, ctx):
|
||||||
global command_dict
|
|
||||||
|
|
||||||
await ctx.message.add_reaction('\N{TABLE TENNIS PADDLE AND BALL}')
|
await ctx.message.add_reaction('\N{TABLE TENNIS PADDLE AND BALL}')
|
||||||
|
|
||||||
await ctx.send(ctx.author.mention + ' \N{TABLE TENNIS PADDLE AND BALL} `' + str(round(self.bot.latency * 1000)) + 'ms`', delete_after=5)
|
await ctx.send(ctx.author.mention + ' \N{TABLE TENNIS PADDLE AND BALL} `' + str(round(self.bot.latency * 1000)) + 'ms`', delete_after=5)
|
||||||
command_dict.setdefault(str(ctx.author.id), {}).update({'command': ctx.command})
|
|
||||||
|
|
||||||
@commands.command(aliases=['pre'], brief='List bot prefixes', description='Shows all used prefixes')
|
@commands.command(aliases=['pre'], brief='List bot prefixes', description='Shows all used prefixes')
|
||||||
@checks.del_ctx()
|
@checks.del_ctx()
|
||||||
|
|
Loading…
Reference in a new issue