Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ import os
|
|
16 |
|
17 |
ph = st.empty()
|
18 |
|
19 |
-
|
20 |
if os.listdir("data") == []:
|
21 |
return 0
|
22 |
with ph.container():
|
@@ -50,7 +50,7 @@ else:
|
|
50 |
print("Streamlit app is already running, only streaming activity.")
|
51 |
clone = True
|
52 |
while True:
|
53 |
-
|
54 |
time.sleep(0.5)
|
55 |
exit()
|
56 |
|
@@ -87,7 +87,7 @@ launch_time = datetime.datetime.utcnow()
|
|
87 |
async def on_ready():
|
88 |
if clone:
|
89 |
print(f"Clone started.")
|
90 |
-
|
91 |
else:
|
92 |
print(f"Logged in as {client.user}")
|
93 |
presence.start()
|
@@ -96,7 +96,7 @@ async def on_ready():
|
|
96 |
@tasks.loop(seconds=60)
|
97 |
async def presence():
|
98 |
if not clone:
|
99 |
-
|
100 |
delta_uptime = datetime.datetime.utcnow() - launch_time
|
101 |
hours, remainder = divmod(int(delta_uptime.total_seconds()), 3600)
|
102 |
minutes, seconds = divmod(remainder, 60)
|
@@ -123,10 +123,10 @@ async def on_disconnect():
|
|
123 |
async def on_message(message):
|
124 |
if clone:
|
125 |
asyncio.sleep(1)
|
126 |
-
|
127 |
return 0
|
128 |
else:
|
129 |
-
|
130 |
for user in message.mentions:
|
131 |
message.content = message.content.replace(f"<@{user.id}>",
|
132 |
f"<@{str(user)}>")
|
@@ -169,7 +169,7 @@ async def on_message(message):
|
|
169 |
)
|
170 |
with open(f"data/{guild_name}/{msgchannel_name}", "r") as f:
|
171 |
context = f.read()
|
172 |
-
|
173 |
if "Feeway" in guild_name:
|
174 |
async with msgchannel.typing():
|
175 |
context += f"GPT4 Correct Assistant:"
|
@@ -216,7 +216,7 @@ async def on_message(message):
|
|
216 |
file = discord.File("image.png", filename="image.png")
|
217 |
embed.set_image(url="attachment://image.png")
|
218 |
await e.edit(embed=embed, attachments=[file])
|
219 |
-
image = RF.image_to_image("image.png")
|
220 |
embed.set_footer(
|
221 |
text=
|
222 |
"""Information or code generated by Lyre may not always be correct. Lyre was made by Araeyn."""
|
|
|
16 |
|
17 |
ph = st.empty()
|
18 |
|
19 |
+
def syncMessages():
|
20 |
if os.listdir("data") == []:
|
21 |
return 0
|
22 |
with ph.container():
|
|
|
50 |
print("Streamlit app is already running, only streaming activity.")
|
51 |
clone = True
|
52 |
while True:
|
53 |
+
syncMessages()
|
54 |
time.sleep(0.5)
|
55 |
exit()
|
56 |
|
|
|
87 |
async def on_ready():
|
88 |
if clone:
|
89 |
print(f"Clone started.")
|
90 |
+
syncMessages()
|
91 |
else:
|
92 |
print(f"Logged in as {client.user}")
|
93 |
presence.start()
|
|
|
96 |
@tasks.loop(seconds=60)
|
97 |
async def presence():
|
98 |
if not clone:
|
99 |
+
syncMessages()
|
100 |
delta_uptime = datetime.datetime.utcnow() - launch_time
|
101 |
hours, remainder = divmod(int(delta_uptime.total_seconds()), 3600)
|
102 |
minutes, seconds = divmod(remainder, 60)
|
|
|
123 |
async def on_message(message):
|
124 |
if clone:
|
125 |
asyncio.sleep(1)
|
126 |
+
syncMessages()
|
127 |
return 0
|
128 |
else:
|
129 |
+
syncMessages()
|
130 |
for user in message.mentions:
|
131 |
message.content = message.content.replace(f"<@{user.id}>",
|
132 |
f"<@{str(user)}>")
|
|
|
169 |
)
|
170 |
with open(f"data/{guild_name}/{msgchannel_name}", "r") as f:
|
171 |
context = f.read()
|
172 |
+
syncMessages()
|
173 |
if "Feeway" in guild_name:
|
174 |
async with msgchannel.typing():
|
175 |
context += f"GPT4 Correct Assistant:"
|
|
|
216 |
file = discord.File("image.png", filename="image.png")
|
217 |
embed.set_image(url="attachment://image.png")
|
218 |
await e.edit(embed=embed, attachments=[file])
|
219 |
+
image = await RF.image_to_image("image.png")
|
220 |
embed.set_footer(
|
221 |
text=
|
222 |
"""Information or code generated by Lyre may not always be correct. Lyre was made by Araeyn."""
|