Fix impersonate command
All checks were successful
Build and Publish college-bot-v2 / build_and_publish (push) Successful in 13s

This commit is contained in:
Nexus 2024-06-08 20:06:59 +01:00
parent c33bce67cb
commit dc53c9e351

View file

@ -1211,7 +1211,7 @@ class Ollama(commands.Cog):
""" """
search = max(10, min(search, 1000)) search = max(10, min(search, 1000))
channels = channels or [ctx.channel] channels = channels or [ctx.channel]
messages = [] messages: list[discord.Message] = []
msg = await ctx.reply("Gathering messages, please wait. This may take a while.") msg = await ctx.reply("Gathering messages, please wait. This may take a while.")
for channel in channels: for channel in channels:
async for message in channel.history(limit=search): async for message in channel.history(limit=search):
@ -1264,10 +1264,9 @@ class Ollama(commands.Cog):
colour=0x6559FF colour=0x6559FF
) )
embed.set_author(name=user.display_name, icon_url=user.display_avatar.url) embed.set_author(name=user.display_name, icon_url=user.display_avatar.url)
msg = await ctx.reply(embed=embed)
last_edit = time.time() last_edit = time.time()
messages = self.history.get_history(thread_id) thread_messages = self.history.get_history(thread_id)
with client.new_chat("llama2-uncensored:7b-chat", messages) as handler: with client.new_chat("llama2-uncensored:7b-chat", thread_messages) as handler:
await msg.edit(content="Generating message...") await msg.edit(content="Generating message...")
async for ln in handler: async for ln in handler:
embed.description += ln["message"]["content"] embed.description += ln["message"]["content"]