mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 13:34:40 +00:00
bold commiting at the end of the day
This commit is contained in:
+45
-26
@@ -11,14 +11,16 @@ from discord.ext import commands
|
||||
|
||||
import ai_functions
|
||||
from constants import (
|
||||
ASSISTANTS,
|
||||
DATA,
|
||||
GRAPHICS_PATH,
|
||||
INITIAL_TIME_WAIT,
|
||||
MASTER_TIMEOUT,
|
||||
OPENAICLIENT,
|
||||
SPECJALNE_ZIEMNIACZKI,
|
||||
WORD_REACTIONS,
|
||||
)
|
||||
|
||||
DM_MODE = "assistant"
|
||||
|
||||
class Events(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
@@ -27,8 +29,41 @@ class Events(commands.Cog):
|
||||
|
||||
async def cog_load(self):
|
||||
self.logger.info("Starting personal assistants")
|
||||
await ai_functions.hammer_assistant_create(self.bot)
|
||||
for superfryta in SPECJALNE_ZIEMNIACZKI.values():
|
||||
if superfryta[4] !="":
|
||||
self.logger.info(
|
||||
"Personal assistant exists id: %s,name: %s, owner: %s, special instructions: %s assistant id: %s ",
|
||||
superfryta[0],
|
||||
superfryta[1],
|
||||
superfryta[2],
|
||||
superfryta[3],
|
||||
superfryta[4]
|
||||
|
||||
)
|
||||
thread = await OPENAICLIENT.beta.threads.create()
|
||||
ASSISTANTS[superfryta[1]] = (superfryta[2], superfryta[0], superfryta[4], thread)
|
||||
else:
|
||||
self.logger.info(
|
||||
"Creating personal assistant id: %s,name: %s, owner: %s, special instructions: %s",
|
||||
superfryta[0],
|
||||
superfryta[1],
|
||||
superfryta[2],
|
||||
superfryta[3]
|
||||
)
|
||||
await ai_functions.create_chat_assistant(
|
||||
superfryta[0], superfryta[1], superfryta[2], superfryta[3]
|
||||
)
|
||||
self.logger.info("Started personal assistants")
|
||||
@commands.hybrid_command(
|
||||
name="switch_dm_mode",
|
||||
description="Jeśli nie wiesz jak użyć tej komendy to nawet nie próbuj",
|
||||
guild=discord.Object(id=664789470779932693),
|
||||
)
|
||||
async def switch_dm_mode(self, ctx):
|
||||
if isinstance(ctx.channel, discord.DMChannel):
|
||||
pass
|
||||
#secrets, assistant, echo, dm
|
||||
#required parameter from list of values - assistant, dm_broadcast, echo
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_message(self, message):
|
||||
@@ -66,30 +101,14 @@ class Events(commands.Cog):
|
||||
if message.channel.id == 1111625221171052595:
|
||||
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()
|
||||
# await channel.send(message.content)
|
||||
# await message.reply(f"Poszlo do Saint {message.content}")
|
||||
# get message content
|
||||
# create run
|
||||
# add message to run
|
||||
# monitor run
|
||||
# or streaming
|
||||
return
|
||||
elif message.author.id == 703985955312238664:
|
||||
# saint pisze DMA
|
||||
self.logger.info(message.content)
|
||||
await message.reply("Hejka Saint!")
|
||||
return
|
||||
else:
|
||||
channel = self.bot.get_channel(1064888712565100614)
|
||||
await channel.send("Słyszałem ja żem że: " + message.content)
|
||||
return
|
||||
for superfryta in SPECJALNE_ZIEMNIACZKI:
|
||||
if message.author.id == superfryta[0]:
|
||||
await self.bot.process_commands(message)
|
||||
await ai_functions.chat_with_assistant(message, superfryta[1])
|
||||
return
|
||||
channel = self.bot.get_channel(1064888712565100614)
|
||||
await channel.send("Słyszałem ja żem że: " + message.content)
|
||||
return
|
||||
channel = message.channel
|
||||
# await self.bot.process_commands(message) #uncomment to bilocate
|
||||
|
||||
|
||||
Reference in New Issue
Block a user