mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-16 06:42:10 +00:00
Tag: 1.20
Intermediate commits (oldest → newest): - A niech spierdala - Fix - fz - almost there - and there - tst - fx - nxtfx - Maybe ready ? - Deploy - step forward - Test - aha - Another attempt - Another one - Największy hit zespuło 100 tvarzy grzybiarzy - i nie jest o piosenka o zgubieniu czapeczki - aaaaaaa - Work ongoing. - bold commiting at the end of the day - :) - fix - Fix - tst - Fix ?
This commit is contained in:
+48
-29
@@ -11,15 +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):
|
||||
self.bot = bot
|
||||
@@ -27,8 +28,42 @@ 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()
|
||||
self.logger.info("Thread id: %s", thread.id)
|
||||
ASSISTANTS[superfryta[1]] = (superfryta[2], superfryta[4], superfryta[0], 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,32 +101,16 @@ class Events(commands.Cog):
|
||||
if message.channel.id == 1111625221171052595:
|
||||
return
|
||||
if isinstance(message.channel, discord.DMChannel):
|
||||
if message.author.id == 346956223645614080:
|
||||
|
||||
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
|
||||
self.logger.info(message.author.id)
|
||||
for superfryta in SPECJALNE_ZIEMNIACZKI.values():
|
||||
self.logger.info(superfryta[0])
|
||||
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