diff --git a/bot/cogs/__init__.py b/bot/cogs/__init__.py index b9ac8b8..ebc7a31 100644 --- a/bot/cogs/__init__.py +++ b/bot/cogs/__init__.py @@ -13,4 +13,4 @@ def __str__(self) -> str: EXTENSIONS = [module.name for module in iter_modules(__path__, f"{__package__}.")] -VERSION: VersionInfo = VersionInfo(major=0, minor=4, micro=0, releaselevel="final") +VERSION: VersionInfo = VersionInfo(major=0, minor=4, micro=1, releaselevel="final") diff --git a/bot/libs/ui/tonetags/modals.py b/bot/libs/ui/tonetags/modals.py index 9ba6d32..0be06a6 100644 --- a/bot/libs/ui/tonetags/modals.py +++ b/bot/libs/ui/tonetags/modals.py @@ -1,3 +1,7 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING + import asyncpg import discord from libs.cog_utils.tonetags import ( @@ -8,6 +12,9 @@ ) from libs.utils import CatherineModal +if TYPE_CHECKING: + from bot.catherinecore import Catherine + class CreateToneTagModal(CatherineModal, title="Create a ToneTag"): def __init__(self, interaction: discord.Interaction, pool: asyncpg.Pool): @@ -36,6 +43,9 @@ async def on_submit(self, interaction: discord.Interaction) -> None: await interaction.response.send_message("The tonetag is invalid.") return + bot: Catherine = interaction.client # type: ignore + bot.metrics.created_tonetags.inc() + status = await create_tonetag( self.indicator.value, self.definition.value, interaction.user.id, self.pool ) diff --git a/bot/libs/ui/tonetags/views.py b/bot/libs/ui/tonetags/views.py index 3c44306..7a6ba4d 100644 --- a/bot/libs/ui/tonetags/views.py +++ b/bot/libs/ui/tonetags/views.py @@ -1,8 +1,16 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING + import asyncpg import discord from libs.cog_utils.tonetags import parse_tonetag from libs.utils import CatherineView, ErrorEmbed, SuccessEmbed +if TYPE_CHECKING: + from bot.catherinecore import Catherine + + NO_CONTROL_MSG = "This menu cannot be controlled by you, sorry!" @@ -30,6 +38,8 @@ async def confirm( status = await self.pool.execute(query, parsed_tonetag, interaction.user.id) if status[-1] != "0": + bot: Catherine = interaction.client # type: ignore + bot.metrics.deleted_tonetags.inc() success_embed = SuccessEmbed() success_embed.description = ( f"Successfully deleted the tonetag `{self.indicator}`" @@ -82,6 +92,8 @@ async def confirm( status = await self.pool.execute(query, self.tonetags_id, interaction.user.id) if status[-1] != "0": + bot: Catherine = interaction.client # type: ignore + bot.metrics.deleted_tonetags.inc() success_embed = SuccessEmbed() success_embed.description = ( f"Successfully deleted the tonetag. (ID: `{self.tonetags_id}`)" diff --git a/changelog.md b/changelog.md index 8cf6da0..4945071 100644 --- a/changelog.md +++ b/changelog.md @@ -1,31 +1,20 @@ -# ✨ Catherine-Chan 0.4.0 +# 🛠️ Catherine-Chan 0.4.1 + +An patch release to add something that was missed in v0.4.0. For more information about the v0.4.0, please see the changelog for (https://github.com/No767/Catherine-Chan/releases/tag/v0.4.0). -This should be one of the last versions (before the topgg stuff gets included) going into prod before the topgg release. This release aims to fix a ton of issues, and brings in several new features. ## ✨ TD;LR -- Completely reworked tonetags module -- HRT converter -- Use Pyright style of public exports for all packages +- Fix tonetag metrics not being counted ## 🛠️ Changes -- Restate usage of code -- Fixed errors related to no tonetags -- Moved error handling to on the `CommandTree` directly -- Move all views (except one) and all modals to `CatherineView` and `CatherineModal`, which are subclasses of `discord.ui.View` and `discord.ui.Modal` respectively. (this reduces on code duplication) -- Use Pyright style of public exports for all packages -- Fix `/tonetags all` json encoding and pretty print for json +- Fix tonetag metrics not being counted ## ✨ Additions -- HRT Converter -- Checks for invalid pronouns examples -- Checks for invalid tonetag names -- Subclassed views and modals -- Expose some more metrics - +- None ## ➖ Removals -- Error Handler cog. Moved to `CatherineCommandTree` +- None \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 25271f3..6f7509f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "catherine-chan" -version = "0.4.0" +version = "0.4.1" description = "An informational LGBTQ based discord bot" authors = ["No767 <73260931+No767@users.noreply.github.com>"] readme = "README.md"