aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar PureFunctor <[email protected]>2020-06-14 14:20:09 +0800
committerGravatar PureFunctor <[email protected]>2020-06-26 01:50:17 +0800
commitbaa20503e716a9ed9ab8be5f82c3456c7b4cfbb5 (patch)
tree59996c5418c0e270e0e4ba8ad08d464baa59f7a6
parentMake caesarcipher a command group (diff)
Add basic caesar cipher information embed
-rw-r--r--bot/exts/evergreen/fun.py13
-rw-r--r--bot/resources/evergreen/caesar_info.json4
2 files changed, 16 insertions, 1 deletions
diff --git a/bot/exts/evergreen/fun.py b/bot/exts/evergreen/fun.py
index 2b1abaa4..f3e3bfcc 100644
--- a/bot/exts/evergreen/fun.py
+++ b/bot/exts/evergreen/fun.py
@@ -1,4 +1,5 @@
import functools
+import json
import logging
import random
from typing import Callable, Tuple, Union
@@ -8,7 +9,7 @@ from discord.ext import commands
from discord.ext.commands import Bot, Cog, Context, MessageConverter
from bot import utils
-from bot.constants import Emojis
+from bot.constants import Colours, Emojis
log = logging.getLogger(__name__)
@@ -100,6 +101,16 @@ class Fun(Cog):
@caesarcipher_group.command(name="info")
async def caesarcipher_info(self, ctx: Context) -> None:
"""Information about the Caesar Cipher."""
+ with open("bot\\resources\\evergreen\\caesar_info.json", "r") as f:
+ data = json.load(f)
+
+ embed = Embed(
+ title=data["title"],
+ description="".join(data["description"]),
+ colour=Colours.dark_green,
+ )
+
+ await ctx.send(embed=embed)
@caesarcipher_group.command(name="translate")
async def caesarcipher_translate(self, ctx: Context, offset: int, *, text: str) -> None:
diff --git a/bot/resources/evergreen/caesar_info.json b/bot/resources/evergreen/caesar_info.json
new file mode 100644
index 00000000..ae3a4656
--- /dev/null
+++ b/bot/resources/evergreen/caesar_info.json
@@ -0,0 +1,4 @@
+{
+ "title": "Caesar Cipher",
+ "description": "**Information**\nThe Caesar Cipher, named after hte Roman General Julius Caesar is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter given a specific position offset in the alphabet, with the letters wrapping around both sides.\n\n**Examples**\n1) `Hello World` <=> `Khoor Zruog` where letters are shifted forwards by `3.`\n2) `Julius Caesar` <=> `Yjaxjh Rpthpg` where letters are shifted backwards by `11.`"
+}