diff options
author | 2018-08-30 12:47:41 +0100 | |
---|---|---|
committer | 2018-08-30 12:47:41 +0100 | |
commit | b4701c8c83fe0149839d120a9b87cac408e8f729 (patch) | |
tree | 1037e45ca2d764f4f8c2cea90713c6d048f5a9c8 | |
parent | [Utils] Pep command outputs help on non-number. Fixes #59 (diff) |
[Snekbox] Show help when eval run without code
-rw-r--r-- | bot/cogs/snekbox.py | 7 |
1 files changed, 6 insertions, 1 deletions
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() |