Araeynn commited on
Commit
b740dff
1 Parent(s): 1c44584

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -17,6 +17,11 @@ import os
17
  ph = st.empty()
18
 
19
  def syncMessages():
 
 
 
 
 
20
  if os.listdir("data") == []:
21
  return 0
22
  with ph.container():
@@ -46,6 +51,7 @@ if not os.path.exists(lock_file_path):
46
  with open(lock_file_path, "w") as f:
47
  f.write("Running!")
48
  clone = False
 
49
  else:
50
  print("Streamlit app is already running, only streaming activity.")
51
  clone = True
@@ -95,7 +101,6 @@ async def on_ready():
95
  @tasks.loop(seconds=60)
96
  async def presence():
97
  if not clone:
98
- syncMessages()
99
  delta_uptime = datetime.datetime.utcnow() - launch_time
100
  hours, remainder = divmod(int(delta_uptime.total_seconds()), 3600)
101
  minutes, seconds = divmod(remainder, 60)
@@ -162,7 +167,6 @@ async def on_message(message):
162
  )
163
  with open(f"data/{guild_name}/{msgchannel_name}", "r") as f:
164
  context = f.read()
165
- syncMessages()
166
  if "Feeway" in guild_name:
167
  async with msgchannel.typing():
168
  context += f"GPT4 Correct Assistant:"
@@ -181,7 +185,6 @@ async def on_message(message):
181
  imgp = ec(output)[0]
182
  with open(f"data/{guild_name}/{msgchannel_name}", "a") as f:
183
  f.write(f"GPT4 Correct Assistant: {output}<|end_of_turn|>")
184
- syncMessages()
185
  embed = discord.Embed(title=title,
186
  description=output.replace(
187
  f"<|title|>{title}<|title|>", "").replace(f"<|image|>{imgp}<|image|>", ""),
 
17
  ph = st.empty()
18
 
19
  def syncMessages():
20
+ delta_uptime = datetime.datetime.utcnow() - launch_time
21
+ hours, remainder = divmod(int(delta_uptime.total_seconds()), 3600)
22
+ minutes, seconds = divmod(remainder, 60)
23
+ days, hours = divmod(hours, 24)
24
+ st.markdown(f":blue[Online Time]: :rainbow[{days:02d}]d | :rainbow[{hours:02d}]h | :rainbow[{minutes:02d}]m | :rainbow[{seconds:02d}]s")
25
  if os.listdir("data") == []:
26
  return 0
27
  with ph.container():
 
51
  with open(lock_file_path, "w") as f:
52
  f.write("Running!")
53
  clone = False
54
+ st.markdown("Bot is running, reload the page to see activity.")
55
  else:
56
  print("Streamlit app is already running, only streaming activity.")
57
  clone = True
 
101
  @tasks.loop(seconds=60)
102
  async def presence():
103
  if not clone:
 
104
  delta_uptime = datetime.datetime.utcnow() - launch_time
105
  hours, remainder = divmod(int(delta_uptime.total_seconds()), 3600)
106
  minutes, seconds = divmod(remainder, 60)
 
167
  )
168
  with open(f"data/{guild_name}/{msgchannel_name}", "r") as f:
169
  context = f.read()
 
170
  if "Feeway" in guild_name:
171
  async with msgchannel.typing():
172
  context += f"GPT4 Correct Assistant:"
 
185
  imgp = ec(output)[0]
186
  with open(f"data/{guild_name}/{msgchannel_name}", "a") as f:
187
  f.write(f"GPT4 Correct Assistant: {output}<|end_of_turn|>")
 
188
  embed = discord.Embed(title=title,
189
  description=output.replace(
190
  f"<|title|>{title}<|title|>", "").replace(f"<|image|>{imgp}<|image|>", ""),