added image logging option

This commit is contained in:
phixxy 2024-03-27 18:51:49 -07:00
parent 04374a6a56
commit f127365fa3

View file

@ -165,6 +165,7 @@ class ChatGPT(commands.Cog):
"chat_enabled":False, "chat_enabled":False,
"chat_history_len":5, "chat_history_len":5,
"react_to_msgs":False, "react_to_msgs":False,
"log_images":False,
} }
with open(filepath,"w") as f: with open(filepath,"w") as f:
@ -274,6 +275,21 @@ class ChatGPT(commands.Cog):
else: else:
await ctx.send("Usage: !chat (enable|disable)") await ctx.send("Usage: !chat (enable|disable)")
@commands.command(
description="Log Images",
help="Enable or disable logging images in this channel. Usage !log_images (enable|disable)",
brief="Enable or disable bot logging images"
)
async def log_images(self, ctx, message):
if "enable" in message:
self.edit_channel_config(ctx.channel.id, "chat_enabled", True)
await ctx.send("Chat Enabled")
elif "disable" in message:
self.edit_channel_config(ctx.channel.id, "chat_enabled", False)
await ctx.send("Chat Disabled")
else:
await ctx.send("Usage: !log_images (enable|disable)")
@commands.command( @commands.command(
description="Reactions", description="Reactions",
help="Enable or disable bot reactions in this channel. Usage !reactions (enable|disable)", help="Enable or disable bot reactions in this channel. Usage !reactions (enable|disable)",
@ -485,7 +501,7 @@ class ChatGPT(commands.Cog):
async def log_chat_and_get_history(self, message, logfile, channel_vars): async def log_chat_and_get_history(self, message, logfile, channel_vars):
log_line = '' log_line = ''
if message.attachments and False:#channel_vars["log_image"]: if message.attachments and channel_vars.get("log_images", False):
#log_image MUST BE ADDED TO THE JSON FILES #log_image MUST BE ADDED TO THE JSON FILES
for attachment in message.attachments: for attachment in message.attachments:
image_description = await self.view_image(attachment.url) image_description = await self.view_image(attachment.url)