Don't go further than taggable history
All checks were successful
Build and Publish Jimmy.2 / build_and_publish (push) Successful in 7s

This commit is contained in:
Nexus 2024-06-03 00:47:24 +01:00
parent 7e6a43214b
commit 315dd82974
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -1020,9 +1020,14 @@ class Ollama(commands.Cog):
" Write using the style of a twitter or facebook post." " Write using the style of a twitter or facebook post."
) )
channel = discord.utils.get(ctx.guild.text_channels, name="spam") channel = discord.utils.get(ctx.guild.text_channels, name="spam")
oldest = discord.Object(1229487300505894964)
async for message in channel.history(limit=max_history): async for message in channel.history(limit=max_history):
if message.created_at <= oldest.created_at:
break
if message.author.id == 1101439218334576742 and len(message.embeds): if message.author.id == 1101439218334576742 and len(message.embeds):
embed = message.embeds[0] embed = message.embeds[0]
if embed.description.strip() == "NEW TRUTH":
continue
if embed.type == "rich" and embed.colour and embed.colour.value == 0x5448EE: if embed.type == "rich" and embed.colour and embed.colour.value == 0x5448EE:
self.history.add_message(thread_id, "assistant", embed.description) self.history.add_message(thread_id, "assistant", embed.description)
self.history.add_message(thread_id, "user", "Generate a new truth post.") self.history.add_message(thread_id, "user", "Generate a new truth post.")