diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 146ab09..7455d31 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -1,6 +1,13 @@
+
+
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ba167c0..74129a3 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,29 +2,16 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -36,90 +23,114 @@
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
+
+
-
+
-
+
-
-
+
+
-
+
-
+
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -127,8 +138,8 @@
-
-
+
+
@@ -136,23 +147,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -160,10 +159,10 @@
-
+
-
+
@@ -174,6 +173,13 @@
+
+
+
+
+
+
+
BibleBot
@@ -182,6 +188,7 @@
misc
votd
random
+ <+
@@ -196,17 +203,21 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -224,6 +235,7 @@
+
@@ -252,21 +264,20 @@
-
+
-
+
-
@@ -319,7 +330,28 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -331,9 +363,11 @@
+
+
@@ -364,24 +398,43 @@
-
-
+
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -390,101 +443,44 @@
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
+
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
@@ -492,5 +488,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 4a576ab..7aa38b1 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ source venv/bin/activate
cp src/config.example.ini src/config.ini
$EDITOR src/config.ini
pip install -U "https://github.com/Rapptz/discord.py/archive/rewrite.zip#egg=discord.py[voice]"
-pip install -U tinydb colorama requests bs4 lxml
+pip install -U tinydb colorama requests bs4 lxml pyaes
python src/bot.py
```
diff --git a/src/bot.py b/src/bot.py
index 84b4f51..421647e 100644
--- a/src/bot.py
+++ b/src/bot.py
@@ -24,7 +24,7 @@ import os
import discord
import central
-from handlers.commandlogic.settings import misc
+from handlers.command_logic import embed_builders
from handlers.commands import CommandHandler
dir_path = os.path.dirname(os.path.realpath(__file__))
@@ -39,7 +39,7 @@ configVersion.read(dir_path + "/config.example.ini")
class OrthoBot(discord.AutoShardedClient):
def __init__(self, *args, loop=None, **kwargs):
super().__init__(*args, loop=loop, **kwargs)
- #self.bg_task = self.loop.create_task(self.run_dailies())
+ self.bg_task = self.loop.create_task(self.run_dailies())
self.current_page = None
self.total_pages = None
@@ -74,15 +74,15 @@ class OrthoBot(discord.AutoShardedClient):
current_time = datetime.datetime.utcnow().strftime("%H:%M")
if daily_time == current_time:
- pass
+ embed = embed_builders.create_daily_embed()
+ await channel.send("Here is today's daily readings and saints/feasts:")
+ await channel.send(embed=embed)
except Exception:
pass
await asyncio.sleep(60)
async def on_message(self, raw):
- await self.wait_until_ready()
-
sender = raw.author
identifier = sender.name + "#" + sender.discriminator
channel = raw.channel
@@ -231,11 +231,7 @@ class OrthoBot(discord.AutoShardedClient):
await msg.clear_reactions()
else:
if "reference" not in res and "text" not in res:
- # noinspection PyBroadException
- try:
- await channel.send(embed=res["message"])
- except Exception:
- pass
+ await channel.send(embed=res["message"])
else:
if res["message"] is not None:
await channel.send(res["message"])
diff --git a/src/handlers/command_logic/__init__.py b/src/handlers/command_logic/__init__.py
new file mode 100644
index 0000000..a879c51
--- /dev/null
+++ b/src/handlers/command_logic/__init__.py
@@ -0,0 +1 @@
+__all__ = ["command_bridge.py"]
diff --git a/src/handlers/commandlogic/commandbridge.py b/src/handlers/command_logic/command_bridge.py
similarity index 68%
rename from src/handlers/commandlogic/commandbridge.py
rename to src/handlers/command_logic/command_bridge.py
index c94b7ba..e90b563 100644
--- a/src/handlers/commandlogic/commandbridge.py
+++ b/src/handlers/command_logic/command_bridge.py
@@ -20,22 +20,11 @@ import json
import math
import os
import sys
-from datetime import date, timedelta
-from http.client import HTTPConnection
-import logging
-import html
import discord
-import requests
-from bs4 import BeautifulSoup
-HTTPConnection.debuglevel = 0
-
-logging.getLogger("requests").setLevel(logging.WARNING)
-logging.getLogger("urllib3").setLevel(logging.WARNING)
-logging.getLogger("urllib3.connectionpool").setLevel(logging.WARNING)
-
-from handlers.commandlogic.settings import misc
+from handlers.command_logic.settings import misc
+from . import embed_builders
dir_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(dir_path + "/../..")
@@ -51,27 +40,28 @@ def run_command(command, args, user, guild, channel):
if command == "orthobot":
embed.title = lang["orthobot"].replace("", central.version.split("v")[1])
- embed.description = lang["code"].replace("repositoryLink", "https://github.com/vypr/OrthoBot")
+ embed.description = lang["code"].replace("repositoryLink", "https://github.com/Oikonomia/OrthoBot")
embed.color = 303102
+ embed.set_thumbnail(url=central.icon)
embed.set_footer(text=central.version, icon_url=central.icon)
response = lang["commandlist"]
- response2 = lang["commandlist2"]
+ #response2 = lang["commandlist2"]
response3 = lang["guildcommandlist"]
response = response.replace("", central.version)
response = response.replace("* ", "")
response = response.replace("+", central.config["OrthoBot"]["commandPrefix"])
- response2 = response2.replace("* ", "")
- response2 = response2.replace("+", central.config["OrthoBot"]["commandPrefix"])
+ #response2 = response2.replace("* ", "")
+ #response2 = response2.replace("+", central.config["OrthoBot"]["commandPrefix"])
response3 = response3.replace("* ", "")
response3 = response3.replace("+", central.config["OrthoBot"]["commandPrefix"])
embed.add_field(name=lang["commandlistName"], value=response, inline=False)
- embed.add_field(name=lang["councillistName"], value=response2, inline=False)
+ #embed.add_field(name=lang["councillistName"], value=response2, inline=False)
embed.add_field(name=lang["guildcommandlistName"], value=response3, inline=False)
return {
@@ -138,8 +128,46 @@ def run_command(command, args, user, guild, channel):
"level": "info",
"message": pages[0]
}
+ elif command == "yesterday":
+ return_embed = embed_builders.create_daily_embed("yesterday")
+
+ return {
+ "level": "info",
+ "message": return_embed
+ }
elif command == "today":
- return_embed = create_embed()
+ return_embed = embed_builders.create_daily_embed()
+
+ return {
+ "level": "info",
+ "message": return_embed
+ }
+ elif command == "tomorrow":
+ return_embed = embed_builders.create_daily_embed("tomorrow")
+
+ return {
+ "level": "info",
+ "message": return_embed
+ }
+ elif command == "random":
+ return_embed = embed_builders.create_daily_embed("random")
+
+ return {
+ "level": "info",
+ "message": return_embed
+ }
+ elif command == "saint" or command == "feast":
+ return_embed = embed_builders.create_saint_embed(args[0])
+
+ return {
+ "level": "info",
+ "message": return_embed
+ }
+ elif command == "lectionary" or command == "reading":
+ if len(args) == 4:
+ return_embed = embed_builders.create_lectionary_embed(args[0], args[1], args[2], _date=args[3])
+ else:
+ return_embed = embed_builders.create_lectionary_embed(args[0], args[1], args[2])
return {
"level": "info",
@@ -151,7 +179,7 @@ def run_command(command, args, user, guild, channel):
if str(user.id) != central.config["OrthoBot"]["owner"]:
if not perms.manage_guild:
embed.color = 16723502
- embed.add_field(name=central.config["OrthoBot"]["commandPrefix"] + lang["commands"]["setdailytime"],
+ embed.add_field(name=central.config["OrthoBot"]["commandPrefix"] + "setdailytime",
value=lang["setdailytimenoperm"])
return {
@@ -163,7 +191,7 @@ def run_command(command, args, user, guild, channel):
embed.color = 303102
embed.set_footer(text=central.version, icon_url=central.icon)
- embed.add_field(name=central.config["OrthoBot"]["commandPrefix"] + lang["commands"]["setdailytime"],
+ embed.add_field(name=central.config["OrthoBot"]["commandPrefix"] + "setdailytime",
value=lang["setdailytimesuccess"])
return {
@@ -172,7 +200,7 @@ def run_command(command, args, user, guild, channel):
}
else:
embed.color = 16723502
- embed.add_field(name=central.config["OrthoBot"]["commandPrefix"] + lang["commands"]["setdailytime"],
+ embed.add_field(name=central.config["OrthoBot"]["commandPrefix"] + "setdailytime",
value=lang["setdailytimefail"])
return {
@@ -185,7 +213,7 @@ def run_command(command, args, user, guild, channel):
if str(user.id) != central.config["OrthoBot"]["owner"]:
if not perms.manage_guild:
embed.color = 16723502
- embed.add_field(name=central.config["OrthoBot"]["commandPrefix"] + lang["commands"]["cleardailytime"],
+ embed.add_field(name=central.config["OrthoBot"]["commandPrefix"] + "cleardailytime",
value=lang["cleardailytimenoperm"])
return {
@@ -197,7 +225,7 @@ def run_command(command, args, user, guild, channel):
embed.color = 303102
embed.set_footer(text=central.version, icon_url=central.icon)
- embed.add_field(name=central.config["OrthoBot"]["commandPrefix"] + lang["commands"]["cleardailytime"],
+ embed.add_field(name=central.config["OrthoBot"]["commandPrefix"] + "cleardailytime",
value=lang["cleardailytimesuccess"])
return {
@@ -217,10 +245,8 @@ def run_command(command, args, user, guild, channel):
response = response.replace("