Skip to content

Commit

Permalink
two eves
Browse files Browse the repository at this point in the history
  • Loading branch information
genekogan committed Sep 24, 2024
1 parent fc2fce9 commit 2442895
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions src/cogs/Eden2Cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@
replace_mentions_with_usernames,
)

long_running_tools = ["txt2vid", "style_mixing", "img2vid", "vid2vid", "video_upscale", "vid2vid_sdxl"]


long_running_tools = ["txt2vid", "style_mixing", "img2vid", "vid2vid", "video_upscale", "vid2vid_sdxl", "lora_trainer", "animate_3D"]

# ALLOWED_CHANNELS = [int(c) for c in os.getenv("ALLOWED_CHANNELS", "").split(",")]
EDEN_CHARACTER_ID = os.getenv("EDEN_CHARACTER_ID")
# EVE_AGENT_ID_ALL = os.getenv("EVE_AGENT_ID_ALL")
# EVE_AGENT_ID_PHOTO = os.getenv("EVE_AGENT_ID_PHOTO")

EVE_AGENT_ID_ALL="66f1c7b4ee5c5f46bbfd3cb8"
EVE_AGENT_ID_PHOTO="66f1c7b5ee5c5f46bbfd3cb9"


#client = EdenClient(stage=True)
client = EdenClient()
client = EdenClient(stage=False)
# client = EdenClient()
print("client", client.api_key)


Expand All @@ -32,6 +39,7 @@ async def button_click(self, button: ui.Button, interaction: discord.Interaction
await interaction.response.send_message("Button was clicked!", ephemeral=True)



video_tools = ["animate_3D", "txt2vid", "img2vid", "vid2vid_sdxl", "style_mixing", "video_upscaler", "reel", "story", "lora_trainer"]
hour_timestamps = {}
day_timestamps = {}
Expand Down Expand Up @@ -75,7 +83,6 @@ def __init__(
bot: commands.bot,
) -> None:
self.bot = bot
self.characterId = EDEN_CHARACTER_ID

@commands.Cog.listener("on_message")
async def on_message(self, message: discord.Message) -> None:
Expand All @@ -89,16 +96,16 @@ async def on_message(self, message: discord.Message) -> None:

is_dm = message.channel.type == discord.ChannelType.private
if is_dm:
thread_name = f"discord5-DM-{message.author.name}-{message.author.id}"
thread_name = f"discord8-DM-{message.author.name}-{message.author.id}"
dm_whitelist = [494760194203451393, 623923865864765452, 404322488215142410, 363287706798653441, 142466375024115712, 598627733576089681, 551619012140990465]
if message.author.id not in dm_whitelist:
return
else:
thread_name = f"discord5-{message.guild.name}-{message.channel.id}-{message.author.id}"
thread_name = f"discord8-{message.guild.name}-{message.channel.id}-{message.author.id}"
trigger_reply = is_mentioned(message, self.bot.user)
if not trigger_reply:
return
if message.channel.id != 1186378591118839808 and message.channel.id != 1006143747588898849 and message.channel.id != 1268682080263606443:
if message.channel.id != 1186378591118839808 and message.channel.id != 1006143747588898849 and message.channel.id != 1268682080263606443 and message.channel.id != 1288181593051107490:
return

if user_over_rate_limits(message.author.id):
Expand Down Expand Up @@ -127,9 +134,11 @@ async def on_message(self, message: discord.Message) -> None:
ctx = await self.bot.get_context(message)
async with ctx.channel.typing():
thread_id = client.get_or_create_thread(thread_name)
#agent_id = EVE_AGENT_ID_PHOTO if message.channel.id == 1288181593051107490 else EVE_AGENT_ID_ALL
agent_id = EVE_AGENT_ID_PHOTO if message.channel.id == 1288181593051107490 else EVE_AGENT_ID_ALL
answered = False

async for response in client.async_chat(chat_message, thread_id):
async for response in client.async_chat(chat_message, thread_id, agent_id):
if 'error' in response:
error_message = response.get("error")
await reply(message, f"Error: {error_message}")
Expand All @@ -154,7 +163,7 @@ async def on_message(self, message: discord.Message) -> None:
if not answered:
await reply(message, content)
else:
await message.channel.send(content)
await send(message, content)
answered = True


Expand All @@ -172,6 +181,10 @@ async def reply(message, content):
for c, chunk in enumerate(content_chunks):
await message.reply(chunk) if c == 0 else await message.channel.send(chunk)

async def send(message, content):
content_chunks = [content[i:i+1980] for i in range(0, len(content), 1980)]
for c, chunk in enumerate(content_chunks):
await message.channel.send(chunk)


welcome_message = """Welcome to Eden, {name}!!!
Expand Down

0 comments on commit 2442895

Please sign in to comment.