diff --git a/ai_commands.py b/ai_commands.py index ab1dae8..90cb532 100644 --- a/ai_commands.py +++ b/ai_commands.py @@ -67,11 +67,9 @@ class Events(commands.Cog): return if isinstance(message.channel, discord.DMChannel): if message.author.id == 346956223645614080: - + await self.bot.process_commands(message) await ai_functions.hammer_assitant_chat(message) - # hammer pisze dma - # DM do Saint - przerobic na komende z parametrem "id" # user = await self.bot.fetch_user(703985955312238664) # channel = await user.create_dm() diff --git a/ai_functions.py b/ai_functions.py index a2f2723..c5e3151 100644 --- a/ai_functions.py +++ b/ai_functions.py @@ -318,5 +318,23 @@ async def hammer_assistant_create(client): async def hammer_assitant_chat(message): + logger = logging.getLogger("discord") content = message.content - await message.channel.send(f"ALOHA!{content}") + assistant_data = ASSISTANTS["Conjurer"] + run = OPENAICLIENT.beta.threads.runs.create_and_poll( + thread_id=assistant_data[3].id, + assistant_id=assistant_data[1].id, + instructions=f"Pisze do Ciebie {assistant_data[0]} udziel mu wszelkiej pomocy", + ) + done = False + while not done: + if run.status == "completed": + messsages = OPENAICLIENT.beta.threads.messages.list( + thread_id=assistant_data[3].id + ) + logger.info(messsages) + done = True + else: + logger.info(run.status) + asyncio.sleep(5) + await message.channel.send(f"Echo: {content}")