aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/fun.py
diff options
context:
space:
mode:
authorGravatar PureFunctor <[email protected]>2020-07-02 19:21:56 +0800
committerGravatar PureFunctor <[email protected]>2020-07-02 19:23:50 +0800
commit52f99c69f882fdc253de594002d404a5b454a971 (patch)
treea38b5296e6ae0367ca7e076080fc678ade039eac /bot/exts/evergreen/fun.py
parentChange text to msg in command docstrings (diff)
Separate the formula for the actual offset
Diffstat (limited to 'bot/exts/evergreen/fun.py')
-rw-r--r--bot/exts/evergreen/fun.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/bot/exts/evergreen/fun.py b/bot/exts/evergreen/fun.py
index 220881d4..5f5c3718 100644
--- a/bot/exts/evergreen/fun.py
+++ b/bot/exts/evergreen/fun.py
@@ -126,8 +126,11 @@ class Fun(Cog):
if not char.isascii() or not char.isalpha() or char.isspace():
yield char
continue
+
case_start = 65 if char.isupper() else 97
- yield chr((ord(char) - case_start + offset) % 26 + case_start)
+ true_offset = (ord(char) - case_start + offset) % 26
+
+ yield chr(case_start + true_offset)
def conversion_func(text: str) -> str:
"""Encrypts the given string using the Caesar Cipher."""