forked from cswimr/SeaCogs
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:
parent
ae31a61436
commit
178a92559c
6 changed files with 62 additions and 30 deletions
|
@ -19,7 +19,8 @@ from pytimeparse2 import disable_dateutil, parse
|
|||
from redbot.core import app_commands, commands, data_manager
|
||||
from redbot.core.app_commands import Choice
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.utils.chat_formatting import box, error, warning
|
||||
from redbot.core.utils.chat_formatting import (box, error, humanize_list,
|
||||
warning)
|
||||
|
||||
from aurora.importers.aurora import ImportAuroraView
|
||||
from aurora.importers.galacticbot import ImportGalacticBotView
|
||||
|
@ -46,8 +47,8 @@ class Aurora(commands.Cog):
|
|||
It is heavily inspired by GalacticBot, and is designed to be a more user-friendly alternative to Red's core Mod cogs.
|
||||
This cog stores all of its data in an SQLite database."""
|
||||
|
||||
__author__ = "SeaswimmerTheFsh"
|
||||
__version__ = "2.0.5"
|
||||
__author__ = ["SeaswimmerTheFsh"]
|
||||
__version__ = "2.0.6"
|
||||
|
||||
async def red_delete_data_for_user(self, *, requester, user_id: int):
|
||||
if requester == "discord_deleted_user":
|
||||
|
@ -86,6 +87,16 @@ class Aurora(commands.Cog):
|
|||
disable_dateutil()
|
||||
self.handle_expiry.start()
|
||||
|
||||
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 cog_load(self):
|
||||
"""This method prepares the database schema for all of the guilds the bot is currently in."""
|
||||
guilds: list[discord.Guild] = self.bot.guilds
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import logging
|
||||
from red_commons.logging import getLogger
|
||||
|
||||
logger = logging.getLogger("red.seacogs.aurora")
|
||||
logger = getLogger("red.seacogs.aurora")
|
||||
|
|
|
@ -7,27 +7,38 @@
|
|||
|
||||
import contextlib
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
|
||||
from red_commons.logging import getLogger
|
||||
from redbot.cogs.downloader import errors
|
||||
from redbot.cogs.downloader.converters import InstalledCog
|
||||
from redbot.core import commands
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.utils.chat_formatting import error, text_to_file
|
||||
from redbot.core.utils.chat_formatting import (error, humanize_list,
|
||||
text_to_file)
|
||||
|
||||
|
||||
# pylint: disable=protected-access
|
||||
class Backup(commands.Cog):
|
||||
"""A utility to make reinstalling repositories and cogs after migrating the bot far easier."""
|
||||
|
||||
__author__ = "SeaswimmerTheFsh"
|
||||
__version__ = "1.0.0"
|
||||
__author__ = ["SeaswimmerTheFsh"]
|
||||
__version__ = "1.0.1"
|
||||
|
||||
def __init__(self, bot: Red):
|
||||
super().__init__()
|
||||
self.bot = bot
|
||||
self.logger = logging.getLogger("red.seacogs.backup")
|
||||
self.logger = getLogger("red.seacogs.backup")
|
||||
|
||||
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)
|
||||
|
||||
@commands.group(autohelp=True)
|
||||
@commands.is_owner()
|
||||
|
|
|
@ -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 = [
|
||||
|
|
|
@ -17,12 +17,22 @@ from redbot.core.utils import chat_formatting, common_filters
|
|||
class Nerdify(commands.Cog):
|
||||
"""Nerdify your text."""
|
||||
|
||||
__author__ = "SeaswimmerTheFsh"
|
||||
__version__ = "1.3.2"
|
||||
__author__ = ["SeaswimmerTheFsh"]
|
||||
__version__ = "1.3.3"
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
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: {chat_formatting.humanize_list(self.__author__)}",
|
||||
]
|
||||
return "\n".join(text)
|
||||
|
||||
@commands.command(aliases=["nerd"])
|
||||
async def nerdify(
|
||||
self, ctx: commands.Context, *, text: Optional[str] = None
|
||||
|
|
|
@ -1,14 +1,4 @@
|
|||
import logging
|
||||
from red_commons.logging import getLogger
|
||||
|
||||
logger = logging.getLogger('red.seacogs.pterodactyl')
|
||||
class WebsocketLogger(logging.Logger):
|
||||
def __init__(self, name, level=logging.NOTSET):
|
||||
super().__init__(name, level)
|
||||
|
||||
def debug(self, msg, *args, **kwargs):
|
||||
self.log(logging.VERBOSE, msg, *args, **kwargs)
|
||||
|
||||
logging.setLoggerClass(WebsocketLogger)
|
||||
websocket_logger = logging.getLogger('red.seacogs.pterodactyl.websocket')
|
||||
logging.VERBOSE = 5
|
||||
logging.addLevelName(logging.VERBOSE, "VERBOSE")
|
||||
logger = getLogger('red.seacogs.pterodactyl')
|
||||
websocket_logger = getLogger('red.seacogs.pterodactyl.websocket')
|
||||
|
|
Loading…
Reference in a new issue