From e59c1665bf3eccd7f80c004b128fccf180f6d72f Mon Sep 17 00:00:00 2001 From: Rafael Bradley Date: Sat, 15 Mar 2025 12:03:53 -0300 Subject: [PATCH] fix(shard): :bug: Allow reporting messages sent *to* Payphone (instead of *by*). --- Dockerfile | 14 ++++++++------ payphone/cogs/calls/cog.py | 13 +++++++++---- pyproject.toml | 2 +- uv.lock | 2 +- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 679000e..7e09ff3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,19 @@ -FROM python:3.12 AS base +FROM registry.nyeki.dev/docker/python/with-uv:3.12-alpine AS base + WORKDIR /app -COPY . . +COPY pyproject.toml uv.lock /app/ -RUN pip install uv -RUN uv sync --no-dev +RUN python3 -m uv sync --no-dev + +COPY . /app/ FROM base AS shard -ENTRYPOINT [ "uv", "run", "--no-dev", "bot.py" ] +CMD [ "bot.py" ] FROM base AS tasks -ENTRYPOINT [ "uv", "run", "--no-dev", "tasks.py" ] +CMD [ "tasks.py" ] diff --git a/payphone/cogs/calls/cog.py b/payphone/cogs/calls/cog.py index e50409b..0179546 100644 --- a/payphone/cogs/calls/cog.py +++ b/payphone/cogs/calls/cog.py @@ -475,10 +475,7 @@ class Calls(base.Cog): "❌ You're banned from using Payphone.", ephemeral=True ) - message_id = await self.bot.call_handler.get_original_message_id(message.id) - author_id = await self.bot.call_handler.get_message_author_id(message_id) - - if author_id is None: + if not await self.bot.call_handler.get_message(message.id): return await ctx.send_response( ( "❌ More than 15 minutes have passed since this message was sent.\n" @@ -487,6 +484,14 @@ class Calls(base.Cog): ephemeral=True, ) + if message.author.bot: + message_id = await self.bot.call_handler.get_original_message_id(message.id) + author_id = await self.bot.call_handler.get_message_author_id(message_id) + + else: + message_id = message.id + author_id = message.author.id + await ctx.send_response("✅ The message has been reported.", ephemeral=True) await models.Report.update_or_create( diff --git a/pyproject.toml b/pyproject.toml index 4298758..e4ca0ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "payphone" -version = "0.37.0" +version = "0.39.0" description = "Add your description here" readme = "README.md" requires-python = ">=3.12" diff --git a/uv.lock b/uv.lock index 24272aa..2452c02 100644 --- a/uv.lock +++ b/uv.lock @@ -353,7 +353,7 @@ wheels = [ [[package]] name = "payphone" -version = "0.36.0" +version = "0.39.0" source = { virtual = "." } dependencies = [ { name = "aerich" },