From b4701c8c83fe0149839d120a9b87cac408e8f729 Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Thu, 30 Aug 2018 12:47:41 +0100 Subject: [Snekbox] Show help when eval run without code --- bot/cogs/snekbox.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bot/cogs/snekbox.py b/bot/cogs/snekbox.py index b3c829d59..6f618a2c7 100644 --- a/bot/cogs/snekbox.py +++ b/bot/cogs/snekbox.py @@ -67,16 +67,21 @@ class Snekbox: @command(name='eval', aliases=('e',)) @guild_only() @check(channel_is_whitelisted_or_author_can_bypass) - async def eval_command(self, ctx: Context, *, code: str): + async def eval_command(self, ctx: Context, *, code: str = None): """ Run some code. get the result back. We've done our best to make this safe, but do let us know if you manage to find an issue with it! + + This command supports multiple lines of code, including code wrapped inside a formatted code block. """ if ctx.author.id in self.jobs: await ctx.send(f"{ctx.author.mention} You've already got a job running - please wait for it to finish!") return + if not code: # None or empty string + return await ctx.invoke(self.bot.get_command("help"), "eval") + log.info(f"Received code from {ctx.author.name}#{ctx.author.discriminator} for evaluation:\n{code}") self.jobs[ctx.author.id] = datetime.datetime.now() -- cgit v1.2.3