Skip to content

Commit

Permalink
dont load file
Browse files Browse the repository at this point in the history
genekogan committed Feb 11, 2024
1 parent b8f0548 commit caea392
Showing 3 changed files with 30 additions and 21 deletions.
18 changes: 11 additions & 7 deletions src/cogs/LogosCharacterCog.py
Original file line number Diff line number Diff line change
@@ -57,10 +57,12 @@ def __init__(

@commands.Cog.listener("on_message")
async def on_message(self, message: discord.Message) -> None:

print("thios is a message")
print("--->")
try:
print("on msg")
print(message)
print(message.content)

except Exception as e:
print(e)
@@ -79,15 +81,15 @@ async def on_message(self, message: discord.Message) -> None:
cutoff = message.created_at - timedelta(minutes=90)
conversation_history = await message.channel.history(after=cutoff).flatten()
conversation = ""
for message in conversation_history[-10:]:
timestamp = message.created_at.strftime("%I:%M %p")
author = message.author.name
for msg in conversation_history[-10:]:
timestamp = msg.created_at.strftime("%I:%M %p")
author = msg.author.name
content = replace_mentions_with_usernames(
message.content,
message.mentions,
msg.content,
msg.mentions,
)
conversation += f"\n{author}{timestamp}\n{content}\n"
#if message.attachments:
#if msg.attachments:

request = {
"character_id": self.characterId,
@@ -101,6 +103,8 @@ async def on_message(self, message: discord.Message) -> None:
if not trigger_reply:
trigger_reply = logos_think(LOGOS_URL, request)

print("TRIG REPLY", trigger_reply)

if trigger_reply:
ctx = await self.bot.get_context(message)
async with ctx.channel.typing():
4 changes: 4 additions & 0 deletions src/common/discord.py
Original file line number Diff line number Diff line change
@@ -20,6 +20,10 @@ def is_mentioned(message: discord.Message, user: discord.User) -> bool:
:param user: The user to check.
:return: True if the user is mentioned, False otherwise.
"""
print("--======")
print(message)
print(message.content)
print("mentions", [m.id for m in message.mentions], "---", user.id)
return user.id in [m.id for m in message.mentions]


29 changes: 15 additions & 14 deletions src/common/eden.py
Original file line number Diff line number Diff line change
@@ -220,22 +220,23 @@ async def generation_loop(
is_video_request,
prefer_gif,
)
if output_url != current_output_url:
current_output_url = output_url
message_update = get_message_update(result)
await edit_message(
message,
start_bot_message,
message_update,
file_update=file,
)
## Intermediate results
# if output_url != current_output_url:
# current_output_url = output_url
# message_update = get_message_update(result)
# await edit_message(
# message,
# start_bot_message,
# message_update,
# file_update=file,
# )
if result["status"] == "completed":
is_connected = await query_user_discord_connection(
api_url, eden_credentials, source.author_id
)
file, output_url = await get_file_update(
result, is_video_request, prefer_gif
)
# file, output_url = await get_file_update(
# result, is_video_request, prefer_gif
# )
view = ui.View()

# view.add_item(
@@ -261,7 +262,7 @@ async def generation_loop(

#if is_video_request:
await parent_message.reply(
start_bot_message + " -> " + creation_url,
start_bot_message + "\n" + creation_url,
files=[],
view=view,
)
@@ -275,7 +276,7 @@ async def generation_loop(
else:
await message.channel.send(
#start_bot_message,
start_bot_message + " -> " + creation_url,
start_bot_message + "\n" + creation_url,
files=[],
#files=[file],
view=view,

0 comments on commit caea392

Please sign in to comment.