Upload to GitLab
This commit is contained in:
+30
-17
@@ -163,6 +163,31 @@ class Calls(base.Cog):
|
||||
|
||||
return await ctx.send(message)
|
||||
|
||||
@commands.command(aliases=["r"])
|
||||
@checks.is_not_banned()
|
||||
async def report(self, ctx: commands.Context) -> None:
|
||||
"""
|
||||
Report a message in a call.
|
||||
"""
|
||||
|
||||
embed = discord.Embed(
|
||||
color=constants.MASK_COLOR,
|
||||
title="Reporting has been moved!",
|
||||
description="📝 This command has been replaced! Payphone has switched to per-message reporting due to the high amount of reports.",
|
||||
fields=[
|
||||
discord.EmbedField(
|
||||
name="Reporting on Desktop",
|
||||
value="Right click the message you want to report and, in the opened menu, press `Apps > Report Message`.",
|
||||
),
|
||||
discord.EmbedField(
|
||||
name="Reporting on Mobile",
|
||||
value="Press and hold the message you want to report and, in the opened menu, press `Apps > Report Message`.",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_message(self, message: discord.Message) -> None:
|
||||
"""
|
||||
@@ -435,7 +460,9 @@ class Calls(base.Cog):
|
||||
|
||||
await webhook.edit_message(propagation_id, content=payload.data["content"])
|
||||
|
||||
@commands.message_command(name="Report Message" if not constants.IS_DEBUG else "(Dev) Report Message")
|
||||
@commands.message_command(
|
||||
name="Report Message" if not constants.IS_DEBUG else "(Dev) Report Message"
|
||||
)
|
||||
async def report_message(
|
||||
self, ctx: discord.ApplicationContext, message: discord.Message
|
||||
) -> None:
|
||||
@@ -448,7 +475,8 @@ class Calls(base.Cog):
|
||||
"❌ You're banned from using Payphone.", ephemeral=True
|
||||
)
|
||||
|
||||
author_id = await self.bot.call_handler.get_message_author_id(message.id)
|
||||
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:
|
||||
return await ctx.send_response(
|
||||
@@ -461,21 +489,6 @@ class Calls(base.Cog):
|
||||
|
||||
await ctx.send_response("✅ The message has been reported.", ephemeral=True)
|
||||
|
||||
message_id: int
|
||||
|
||||
if message.author.bot:
|
||||
message_id = await self.bot.call_handler.get_original_message_id(message.id)
|
||||
|
||||
else:
|
||||
message_id = message.id
|
||||
|
||||
if message_id != message.id:
|
||||
cached_message = await self.bot.call_handler.get_message(message_id)
|
||||
|
||||
message = await self.bot.get_partial_messageable(
|
||||
cached_message.channel_id
|
||||
).fetch_message(message_id)
|
||||
|
||||
await models.Report.update_or_create(
|
||||
message_id=message_id,
|
||||
defaults={
|
||||
|
||||
Reference in New Issue
Block a user