From 60fa2bae75aa07e271ab6e1757b4017f52badcf2 Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Fri, 22 Mar 2024 12:46:16 +0530 Subject: [PATCH] Migrate to `framework.isobot.colors` module for stdout colors --- framework/isobot/db/automod.py | 3 ++- framework/isobot/db/items.py | 3 ++- framework/isobot/db/levelling.py | 3 ++- framework/isobot/db/presence.py | 5 +++-- framework/isobot/db/userdata.py | 3 ++- framework/isobot/db/weather.py | 13 +++---------- 6 files changed, 14 insertions(+), 16 deletions(-) diff --git a/framework/isobot/db/automod.py b/framework/isobot/db/automod.py index 9b803e65..564e7738 100644 --- a/framework/isobot/db/automod.py +++ b/framework/isobot/db/automod.py @@ -2,12 +2,13 @@ # Imports import json +from framework.isobot.colors import Colors as colors # Functions class Automod(): """Initializes the Automod database system.""" def __init__(self): - print("[framework/db/Automod] Automod db library initialized.") + print(f"[framework/db/Automod] {colors.green}Automod db library initialized.{colors.end}") def load(self) -> dict: """Fetches and returns the latest data from the items database.""" diff --git a/framework/isobot/db/items.py b/framework/isobot/db/items.py index 8dc6a80b..cf19cc92 100644 --- a/framework/isobot/db/items.py +++ b/framework/isobot/db/items.py @@ -1,6 +1,7 @@ """The framework module library used for managing isobot's items database.""" # Imports import json +from framework.isobot.colors import Colors as colors from framework.isobot.shop import ShopData # Variables @@ -11,7 +12,7 @@ class Items(): """Used to initialize the items database.""" def __init__(self): - print("[framework/db/Levelling] Items db library initialized.") + print(f"[framework/db/Levelling] {colors.green}Items db library initialized.{colors.end}") def load(self) -> dict: """Fetches and returns the latest data from the items database.""" diff --git a/framework/isobot/db/levelling.py b/framework/isobot/db/levelling.py index 0b022517..e8911300 100644 --- a/framework/isobot/db/levelling.py +++ b/framework/isobot/db/levelling.py @@ -1,12 +1,13 @@ """The framework module library used for managing isobot's levelling database.""" # Imports import json +from framework.isobot.colors import Colors as colors # Functions class Levelling(): """Used to initialize the levelling database.""" def __init__(self): - print("[framework/db/Levelling] Levelling db library initialized.") + print(f"[framework/db/Levelling] {colors.green}Levelling db library initialized.{colors.end}") def load(self) -> dict: """Fetches and returns the latest data from the levelling database.""" diff --git a/framework/isobot/db/presence.py b/framework/isobot/db/presence.py index 83036ec7..0c5eb267 100644 --- a/framework/isobot/db/presence.py +++ b/framework/isobot/db/presence.py @@ -3,13 +3,14 @@ # Imports import json import time +from framework.isobot.colors import Colors as colors # Functions class Presence(): """Used to initialize the User Presence system.""" def __init__(self): - print("[framework/db/UserData] Presence database initialized.") - + print(f"[framework/db/UserData] {colors.green}Presence database initialized.{colors.end}") + def load(self) -> dict: """Fetches and returns the latest data from the presence database.""" with open("database/presence.json", 'r', encoding="utf8") as f: db = json.load(f) diff --git a/framework/isobot/db/userdata.py b/framework/isobot/db/userdata.py index a5c3f58a..78b8f386 100644 --- a/framework/isobot/db/userdata.py +++ b/framework/isobot/db/userdata.py @@ -2,12 +2,13 @@ # Imports import json +from framework.isobot.colors import Colors as colors # Functions class UserData(): """Used to initialize the UserData system.""" def __init__(self): - print("[framework/db/UserData] UserData library initialized.") + print(f"[framework/db/UserData] {colors.green}UserData library initialized.{colors.end}") def load(self) -> dict: """Fetches and returns the latest data from the levelling database.""" diff --git a/framework/isobot/db/weather.py b/framework/isobot/db/weather.py index 40948256..852fde9e 100644 --- a/framework/isobot/db/weather.py +++ b/framework/isobot/db/weather.py @@ -1,20 +1,13 @@ # Imports import json +from framework.isobot.colors import Colors as colors from discord import User -# Classes -class Colors: - """Contains general stdout colors.""" - cyan = '\033[96m' - red = '\033[91m' - green = '\033[92m' - end = '\033[0m' - # Functions -class Weather(Colors): +class Weather(): """Class to manage the weather db""" def __init__(self): - print(f"[Framework/Loader] {Colors.green}Weather database initialized.{Colors.end}") + print(f"[Framework/Loader] {colors.green}Weather database initialized.{colors.end}") def load(self) -> dict: """Fetches and returns the latest data from the levelling database."""