diff --git a/payphone/bot.py b/payphone/bot.py index 0e5ecd0..e60609c 100644 --- a/payphone/bot.py +++ b/payphone/bot.py @@ -380,6 +380,7 @@ bot = Payphone() bot.load_extension("payphone.cogs.admin.cog") bot.load_extension("payphone.cogs.calls.cog") +bot.load_extension("payphone.cogs.easter.cog") bot.load_extension("payphone.cogs.mods.cog") bot.load_extension("payphone.cogs.users.cog") bot.load_extension("payphone.cogs.utility.cog") diff --git a/payphone/cogs/calls/embeds.py b/payphone/cogs/calls/embeds.py index 97d1e5f..951d282 100644 --- a/payphone/cogs/calls/embeds.py +++ b/payphone/cogs/calls/embeds.py @@ -29,11 +29,11 @@ async def ReplyEmbed( .select_related("profile", "channel", "propagation_channel") ) - is_this_channel = message.id == reference.message_id - if message is None: return None + is_this_channel = message.id == reference.message_id + last_content: models.MessageContent | None = None for content in message.contents: diff --git a/payphone/cogs/easter/__init__.py b/payphone/cogs/easter/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/payphone/cogs/easter/cog.py b/payphone/cogs/easter/cog.py new file mode 100644 index 0000000..8a940bf --- /dev/null +++ b/payphone/cogs/easter/cog.py @@ -0,0 +1,53 @@ +import secrets + +from discord.ext import commands + +from tortoise import transactions + +from payphone import bot +from payphone.db import models +from payphone.cogs import base +from payphone.core import constants + + +class Easter(base.Cog): + show_in_help = False + + def __init__(self, bot_instance: bot.Payphone): + self.bot = bot_instance + + @commands.command() + @transactions.atomic() + async def catmask(self, ctx: commands.Context) -> None: + """ + This is a secret command! + """ + + await ctx.message.delete() + + new_mask = secrets.choice(constants.CAT_MASKS_LIST) + + channel_rs = ( + await models.CallUserChannelRelationship.filter( + channel_id=ctx.channel.id, user_id=ctx.author.id + ) + .limit(1) + .select_related("call") + .first() + ) + + if channel_rs is None or channel_rs.call.ended_at is not None: + return + + channel_rs.mask = new_mask.value + await channel_rs.save() + + +def setup(b: bot.Payphone) -> None: + """Load the cog into the bot. + + Args: + b (bot.Payphone): The bot instance to load the cog into. + """ + + b.add_cog(Easter(b)) diff --git a/payphone/cogs/mods/cog.py b/payphone/cogs/mods/cog.py index 825213e..28f270a 100644 --- a/payphone/cogs/mods/cog.py +++ b/payphone/cogs/mods/cog.py @@ -59,7 +59,7 @@ class Mods(base.Cog): if row.expires_at: message += f"{f" for `{fmt.time_to_text(duration)}`" if duration is not None else ""} until ()" - + else: message += " permanently" @@ -373,9 +373,9 @@ class Mods(base.Cog): diff = value - prev_value rows_with_diff[stat_i].append( - value + f"{value:,}" if diff == 0 - else (value, f"({"+" if diff > 0 else ""}{diff})") + else (f"{value:,}", f"({"+" if diff > 0 else ""}{diff})") ) table = fmt.monospace_table(