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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user