aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/fun.py
diff options
context:
space:
mode:
authorGravatar PureFunctor <[email protected]>2020-06-25 23:47:30 +0800
committerGravatar PureFunctor <[email protected]>2020-06-26 01:50:18 +0800
commitf1a79fb65a98c4c483b3e77dfb1c910c8702165b (patch)
treec20bd176eba0c025be7f28ced15dfc8eb2772c5f /bot/exts/evergreen/fun.py
parentRefactor translate subcommand to encrypt and decrypt (diff)
Add offset validation
Diffstat (limited to 'bot/exts/evergreen/fun.py')
-rw-r--r--bot/exts/evergreen/fun.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/bot/exts/evergreen/fun.py b/bot/exts/evergreen/fun.py
index 75b0e2b0..364ce74b 100644
--- a/bot/exts/evergreen/fun.py
+++ b/bot/exts/evergreen/fun.py
@@ -154,7 +154,10 @@ class Fun(Cog):
Also accepts a valid Discord Message ID or link.
"""
- await self._caesar_cipher(ctx, offset, text)
+ if offset < 0:
+ await ctx.send(":no_entry: Cannot use a negative offset.")
+ else:
+ await self._caesar_cipher(ctx, offset, text)
@caesarcipher_group.command(name="decrypt", aliases=("leftshift", "lshift"))
async def caesarcipher_decrypt(self, ctx: Context, offset: int, *, text: str) -> None:
@@ -165,7 +168,10 @@ class Fun(Cog):
Also accepts a valid Discord Message ID or link.
"""
- await self._caesar_cipher(ctx, -offset, text)
+ if offset < 0:
+ await ctx.send(":no_entry: Cannot use a negative offset.")
+ else:
+ await self._caesar_cipher(ctx, -offset, text)
@staticmethod
async def _get_text_and_embed(ctx: Context, text: str) -> Tuple[str, Union[Embed, None]]: