fix(bot): 🐛 Replies not working when message comes from outside the call.
This commit is contained in:
@@ -380,6 +380,7 @@ bot = Payphone()
|
|||||||
|
|
||||||
bot.load_extension("payphone.cogs.admin.cog")
|
bot.load_extension("payphone.cogs.admin.cog")
|
||||||
bot.load_extension("payphone.cogs.calls.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.mods.cog")
|
||||||
bot.load_extension("payphone.cogs.users.cog")
|
bot.load_extension("payphone.cogs.users.cog")
|
||||||
bot.load_extension("payphone.cogs.utility.cog")
|
bot.load_extension("payphone.cogs.utility.cog")
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ async def ReplyEmbed(
|
|||||||
.select_related("profile", "channel", "propagation_channel")
|
.select_related("profile", "channel", "propagation_channel")
|
||||||
)
|
)
|
||||||
|
|
||||||
is_this_channel = message.id == reference.message_id
|
|
||||||
|
|
||||||
if message is None:
|
if message is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
is_this_channel = message.id == reference.message_id
|
||||||
|
|
||||||
last_content: models.MessageContent | None = None
|
last_content: models.MessageContent | None = None
|
||||||
|
|
||||||
for content in message.contents:
|
for content in message.contents:
|
||||||
|
|||||||
@@ -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))
|
||||||
@@ -59,7 +59,7 @@ class Mods(base.Cog):
|
|||||||
|
|
||||||
if row.expires_at:
|
if row.expires_at:
|
||||||
message += f"{f" for `{fmt.time_to_text(duration)}`" if duration is not None else ""} until <t:{int(row.expires_at.timestamp())}:F> (<t:{int(row.expires_at.timestamp())}:R>)"
|
message += f"{f" for `{fmt.time_to_text(duration)}`" if duration is not None else ""} until <t:{int(row.expires_at.timestamp())}:F> (<t:{int(row.expires_at.timestamp())}:R>)"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
message += " permanently"
|
message += " permanently"
|
||||||
|
|
||||||
@@ -373,9 +373,9 @@ class Mods(base.Cog):
|
|||||||
diff = value - prev_value
|
diff = value - prev_value
|
||||||
|
|
||||||
rows_with_diff[stat_i].append(
|
rows_with_diff[stat_i].append(
|
||||||
value
|
f"{value:,}"
|
||||||
if diff == 0
|
if diff == 0
|
||||||
else (value, f"({"+" if diff > 0 else ""}{diff})")
|
else (f"{value:,}", f"({"+" if diff > 0 else ""}{diff})")
|
||||||
)
|
)
|
||||||
|
|
||||||
table = fmt.monospace_table(
|
table = fmt.monospace_table(
|
||||||
|
|||||||
Reference in New Issue
Block a user