fix: Update emoji and sticker description fallback to indicate potential AI filtering
This commit is contained in:
parent
0858185456
commit
f07d569548
11
gurt/cog.py
11
gurt/cog.py
@ -280,14 +280,14 @@ class GurtCog(commands.Cog, name="Gurt"): # Added explicit Cog name
|
|||||||
existing_emoji.get("id") == str(emoji.id) and \
|
existing_emoji.get("id") == str(emoji.id) and \
|
||||||
existing_emoji.get("url") == emoji_url and \
|
existing_emoji.get("url") == emoji_url and \
|
||||||
existing_emoji.get("description") and \
|
existing_emoji.get("description") and \
|
||||||
existing_emoji.get("description") != "No description generated.":
|
existing_emoji.get("description") != "No description generated. (Likely was filtered by AI)":
|
||||||
# print(f"Skipping already processed emoji: {name_key} in guild {emoji.guild.name}")
|
# print(f"Skipping already processed emoji: {name_key} in guild {emoji.guild.name}")
|
||||||
return
|
return
|
||||||
|
|
||||||
print(f"Generating description for emoji: {name_key} in guild {emoji.guild.name}")
|
print(f"Generating description for emoji: {name_key} in guild {emoji.guild.name}")
|
||||||
mime_type = "image/gif" if emoji.animated else "image/png"
|
mime_type = "image/gif" if emoji.animated else "image/png"
|
||||||
description = await api.generate_image_description(self, emoji_url, emoji.name, "emoji", mime_type)
|
description = await api.generate_image_description(self, emoji_url, emoji.name, "emoji", mime_type)
|
||||||
await self.emoji_manager.add_emoji(name_key, str(emoji.id), emoji.animated, guild_id, emoji_url, description or "No description generated.")
|
await self.emoji_manager.add_emoji(name_key, str(emoji.id), emoji.animated, guild_id, emoji_url, description or "No description generated. (Likely was filtered by AI)")
|
||||||
# await asyncio.sleep(1) # Rate limiting removed for faster parallel processing
|
# await asyncio.sleep(1) # Rate limiting removed for faster parallel processing
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error processing single emoji {emoji.name} (ID: {emoji.id}) in guild {emoji.guild.name}: {e}")
|
print(f"Error processing single emoji {emoji.name} (ID: {emoji.id}) in guild {emoji.guild.name}: {e}")
|
||||||
@ -303,13 +303,12 @@ class GurtCog(commands.Cog, name="Gurt"): # Added explicit Cog name
|
|||||||
if existing_sticker and \
|
if existing_sticker and \
|
||||||
existing_sticker.get("id") == str(sticker.id) and \
|
existing_sticker.get("id") == str(sticker.id) and \
|
||||||
existing_sticker.get("url") == sticker_url and \
|
existing_sticker.get("url") == sticker_url and \
|
||||||
existing_sticker.get("description") and \
|
existing_sticker.get("description"):
|
||||||
existing_sticker.get("description") not in ["No description generated.", "Lottie animation, visual description not applicable."]:
|
|
||||||
# print(f"Skipping already processed sticker: {name_key} in guild ID {guild_id}")
|
# print(f"Skipping already processed sticker: {name_key} in guild ID {guild_id}")
|
||||||
return
|
return
|
||||||
|
|
||||||
print(f"Generating description for sticker: {sticker.name} (ID: {sticker.id}) in guild ID {guild_id}")
|
print(f"Generating description for sticker: {sticker.name} (ID: {sticker.id}) in guild ID {guild_id}")
|
||||||
description_to_add = "No description generated."
|
description_to_add = "No description generated. (Likely was filtered by AI)"
|
||||||
if sticker.format == discord.StickerFormatType.png or sticker.format == discord.StickerFormatType.apng or sticker.format == discord.StickerFormatType.gif:
|
if sticker.format == discord.StickerFormatType.png or sticker.format == discord.StickerFormatType.apng or sticker.format == discord.StickerFormatType.gif:
|
||||||
format_to_mime = {
|
format_to_mime = {
|
||||||
discord.StickerFormatType.png: "image/png",
|
discord.StickerFormatType.png: "image/png",
|
||||||
@ -318,7 +317,7 @@ class GurtCog(commands.Cog, name="Gurt"): # Added explicit Cog name
|
|||||||
}
|
}
|
||||||
mime_type = format_to_mime.get(sticker.format, "image/png")
|
mime_type = format_to_mime.get(sticker.format, "image/png")
|
||||||
description = await api.generate_image_description(self, sticker_url, sticker.name, "sticker", mime_type)
|
description = await api.generate_image_description(self, sticker_url, sticker.name, "sticker", mime_type)
|
||||||
description_to_add = description or "No description generated."
|
description_to_add = description or "No description generated. (Likely was filtered by AI)"
|
||||||
elif sticker.format == discord.StickerFormatType.lottie:
|
elif sticker.format == discord.StickerFormatType.lottie:
|
||||||
description_to_add = "Lottie animation, visual description not applicable."
|
description_to_add = "Lottie animation, visual description not applicable."
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user