mirror of
https://github.com/pacnpal/Pac-cogs.git
synced 2025-12-20 19:01:06 -05:00
Update message handling and reactions
- Add 📹 reaction at start of processing - Add ⏳ reaction during processing - Change to ✅ when complete - Update message template to show username and channel - Remove author mention for cleaner format - Add better reaction cleanup on errors - Add better error context and handling
This commit is contained in:
@@ -65,7 +65,7 @@ class VideoArchiver(commands.Cog):
|
|||||||
"max_file_size": 8,
|
"max_file_size": 8,
|
||||||
"delete_after_repost": True,
|
"delete_after_repost": True,
|
||||||
"message_duration": 24,
|
"message_duration": 24,
|
||||||
"message_template": "Archived video from {author}\nOriginal: {original_message}",
|
"message_template": "Video from {username} in #{channel}\nOriginal: {original_message}",
|
||||||
"enabled_sites": [],
|
"enabled_sites": [],
|
||||||
"concurrent_downloads": 3,
|
"concurrent_downloads": 3,
|
||||||
"disable_update_check": False,
|
"disable_update_check": False,
|
||||||
@@ -711,6 +711,8 @@ class VideoArchiver(commands.Cog):
|
|||||||
await self.initialize_guild_components(guild_id)
|
await self.initialize_guild_components(guild_id)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# Add initial reactions
|
||||||
|
await message.add_reaction("📹")
|
||||||
await message.add_reaction("⏳")
|
await message.add_reaction("⏳")
|
||||||
await self.log_message(message.guild, f"Processing video URL: {url}")
|
await self.log_message(message.guild, f"Processing video URL: {url}")
|
||||||
|
|
||||||
@@ -718,6 +720,7 @@ class VideoArchiver(commands.Cog):
|
|||||||
|
|
||||||
# Check user roles
|
# Check user roles
|
||||||
if not self._check_user_roles(message.author, settings["allowed_roles"]):
|
if not self._check_user_roles(message.author, settings["allowed_roles"]):
|
||||||
|
await message.remove_reaction("⏳", self.bot.user)
|
||||||
await message.add_reaction("🚫")
|
await message.add_reaction("🚫")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -727,6 +730,7 @@ class VideoArchiver(commands.Cog):
|
|||||||
].download_video(url)
|
].download_video(url)
|
||||||
|
|
||||||
if not success:
|
if not success:
|
||||||
|
await message.remove_reaction("⏳", self.bot.user)
|
||||||
await message.add_reaction("❌")
|
await message.add_reaction("❌")
|
||||||
await self.log_message(
|
await self.log_message(
|
||||||
message.guild, f"Failed to download video: {error}", "error"
|
message.guild, f"Failed to download video: {error}", "error"
|
||||||
@@ -755,12 +759,8 @@ class VideoArchiver(commands.Cog):
|
|||||||
# Send notification with information
|
# Send notification with information
|
||||||
notification_message = await notification_channel.send(
|
notification_message = await notification_channel.send(
|
||||||
self.components[guild_id]["message_manager"].format_archive_message(
|
self.components[guild_id]["message_manager"].format_archive_message(
|
||||||
author=message.author.mention,
|
username=message.author.name,
|
||||||
url=(
|
channel=message.channel.name,
|
||||||
archive_message.attachments[0].url
|
|
||||||
if archive_message.attachments
|
|
||||||
else "No URL available"
|
|
||||||
),
|
|
||||||
original_message=message.jump_url,
|
original_message=message.jump_url,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -772,6 +772,8 @@ class VideoArchiver(commands.Cog):
|
|||||||
notification_message.id, notification_message.delete
|
notification_message.id, notification_message.delete
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Update reaction to show completion
|
||||||
|
await message.remove_reaction("⏳", self.bot.user)
|
||||||
await message.add_reaction("✅")
|
await message.add_reaction("✅")
|
||||||
await self.log_message(
|
await self.log_message(
|
||||||
message.guild, f"Successfully archived video from {message.author}"
|
message.guild, f"Successfully archived video from {message.author}"
|
||||||
@@ -781,6 +783,7 @@ class VideoArchiver(commands.Cog):
|
|||||||
await self.log_message(
|
await self.log_message(
|
||||||
message.guild, f"Failed to upload video: {str(e)}", "error"
|
message.guild, f"Failed to upload video: {str(e)}", "error"
|
||||||
)
|
)
|
||||||
|
await message.remove_reaction("⏳", self.bot.user)
|
||||||
await message.add_reaction("❌")
|
await message.add_reaction("❌")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -806,6 +809,7 @@ class VideoArchiver(commands.Cog):
|
|||||||
await self.log_message(
|
await self.log_message(
|
||||||
message.guild, f"Error processing video: {str(e)}", "error"
|
message.guild, f"Error processing video: {str(e)}", "error"
|
||||||
)
|
)
|
||||||
|
await message.remove_reaction("⏳", self.bot.user)
|
||||||
await message.add_reaction("❌")
|
await message.add_reaction("❌")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user