feat(shard): ✨ Handle attachments on call.

Attachments can now be sent by moderators. Users are now notified when they can't send attachments, and if their message has text other than attachments, the other party gets notified that attachments were removed from the message.
This commit is contained in:
2025-03-16 12:23:29 -03:00
parent a8cc3ebfd3
commit 86453cb58c
2 changed files with 26 additions and 4 deletions
+23
View File
@@ -257,6 +257,8 @@ class Calls(base.Cog):
message_content = self.bot.clean_message(message)
has_sent_attachments = False
if message.stickers:
if participant.user.flag & (
models.UserFlag.SUPPORTER | models.UserFlag.MODERATOR
@@ -272,6 +274,24 @@ class Calls(base.Cog):
"page](<https://ko-fi.com/payphonedev>)."
)
if message.attachments:
if participant.user.flag & models.UserFlag.MODERATOR
for attachment in message.attachments:
message_content += (
f"[{constants.BRAILE_CHARACTER}]({attachment.url})"
)
else:
await message.channel.send(
f"❌ **{participant.display_name}** You can't send attachments in calls."
)
if not message_content:
return
else:
has_sent_attachments = True
embeds = []
if message.reference:
@@ -388,6 +408,9 @@ class Calls(base.Cog):
)
)
if has_sent_attachments:
message_content += "\n-# ⓘ Attachments were removed from this message."
async with aiohttp.ClientSession() as session:
for _ in range(3):
try:
Generated
+3 -4
View File
@@ -1,5 +1,4 @@
version = 1
revision = 1
requires-python = ">=3.12"
[[package]]
@@ -128,7 +127,7 @@ version = "8.1.8"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "anyio" },
{ name = "colorama", marker = "sys_platform == 'win32'" },
{ name = "colorama", marker = "platform_system == 'Windows'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/cb/b5/e1e5fdf1c1bb7e6e614987c120a98d9324bf8edfaa5f5cd16a6235c9d91b/asyncclick-8.1.8.tar.gz", hash = "sha256:0f0eb0f280e04919d67cf71b9fcdfb4db2d9ff7203669c40284485c149578e4c", size = 232900 }
wheels = [
@@ -198,7 +197,7 @@ name = "click"
version = "8.1.8"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "colorama", marker = "sys_platform == 'win32'" },
{ name = "colorama", marker = "platform_system == 'Windows'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/b9/2e/0090cbf739cee7d23781ad4b89a9894a41538e4fcf4c31dcdd705b78eb8b/click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a", size = 226593 }
wheels = [
@@ -414,7 +413,7 @@ wheels = [
[[package]]
name = "payphone"
version = "0.54.0"
version = "0.55.0"
source = { virtual = "." }
dependencies = [
{ name = "aerich" },