diff options
| author | 2020-07-02 19:21:56 +0800 | |
|---|---|---|
| committer | 2020-07-02 19:23:50 +0800 | |
| commit | 52f99c69f882fdc253de594002d404a5b454a971 (patch) | |
| tree | a38b5296e6ae0367ca7e076080fc678ade039eac | |
| parent | Change text to msg in command docstrings (diff) | |
Separate the formula for the actual offset
| -rw-r--r-- | bot/exts/evergreen/fun.py | 5 | 
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.""" | 
