feat(repo): added help formatters for version numbers to cogs that have them and migrated to using red's inbuilt loggers instead of logging.getLogger

This commit is contained in:
SeaswimmerTheFsh 2024-03-07 03:38:34 -05:00
parent ae31a61436
commit 178a92559c
Signed by untrusted user: cswimr
GPG key ID: B8953EC01E5C4063
6 changed files with 62 additions and 30 deletions

View file

@ -5,14 +5,14 @@
# ____) | __/ (_| \__ \\ V V /| | | | | | | | | | | | __/ |
# |_____/ \___|\__,_|___/ \_/\_/ |_|_| |_| |_|_| |_| |_|\___|_|
import logging
import random
import aiohttp
from discord import Embed
from red_commons.logging import getLogger
from redbot.core import Config, commands
from redbot.core.bot import Red
from redbot.core.utils.chat_formatting import error
from redbot.core.utils.chat_formatting import error, humanize_list
import bible.errors
from bible.models import Version
@ -21,8 +21,8 @@ from bible.models import Version
class Bible(commands.Cog):
"""Retrieve Bible verses from the API.bible API."""
__author__ = "SeaswimmerTheFsh"
__version__ = "1.0.0"
__author__ = ["SeaswimmerTheFsh"]
__version__ = "1.0.1"
def __init__(self, bot: Red):
super().__init__()
@ -31,10 +31,20 @@ class Bible(commands.Cog):
self.config = Config.get_conf(
self, identifier=481923957134912, force_registration=True
)
self.logger = logging.getLogger("red.seacogs.bible")
self.logger = getLogger("red.seacogs.bible")
self.config.register_global(bible="de4e12af7f28f599-02")
self.config.register_user(bible=None)
def format_help_for_context(self, ctx: commands.Context) -> str:
pre_processed = super().format_help_for_context(ctx) or ""
n = "\n" if "\n\n" not in pre_processed else ""
text = [
f"{pre_processed}{n}",
f"Cog Version: **{self.__version__}**",
f"Author: {humanize_list(self.__author__)}",
]
return "\n".join(text)
async def translate_book_name(self, bible_id: str, book_name: str) -> str:
"""Translate a book name to a book ID."""
book_name_list = [