Araeynn commited on
Commit
505cd66
1 Parent(s): 00e2b05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -163,26 +163,30 @@ async def on_message(message):
163
  os.mkdir("data/" + guild_name)
164
  except:
165
  pass
 
 
 
 
166
  if os.path.exists(f"data/{guild_name}/{msgchannel_name}"):
167
  with open(f"data/{guild_name}/{msgchannel_name}", "a") as f:
168
  n = "\n"
169
  if message.author.bot:
170
  f.write(
171
- f"""GPT4 Correct {message.author}[bot]: {message.content.strip(n)}<|end_of_turn|>"""
172
  )
173
  else:
174
  f.write(
175
- f"""GPT4 Correct {message.author}: {message.content.strip(n)}<|end_of_turn|>"""
176
  )
177
  else:
178
  with open(f"data/{guild_name}/{msgchannel_name}", "w") as f:
179
  if message.author.bot:
180
  f.write(
181
- f"GPT4 Correct system: {sysp}<|end_of_turn|>GPT4 Correct {message.author}[bot]: {message.content}<|end_of_turn|>"
182
  )
183
  else:
184
  f.write(
185
- f"GPT4 Correct system: {sysp}<|end_of_turn|>GPT4 Correct {message.author}: {message.content}<|end_of_turn|>"
186
  )
187
  with open(f"data/{guild_name}/{msgchannel_name}", "r") as f:
188
  context = f.read()
 
163
  os.mkdir("data/" + guild_name)
164
  except:
165
  pass
166
+ caption = ""
167
+ if len(message.attachments) > 0:
168
+ await message.attachments[0].save("ip")
169
+ caption = f"(Image:[{C.image_to_text("ip")}])"
170
  if os.path.exists(f"data/{guild_name}/{msgchannel_name}"):
171
  with open(f"data/{guild_name}/{msgchannel_name}", "a") as f:
172
  n = "\n"
173
  if message.author.bot:
174
  f.write(
175
+ f"""GPT4 Correct {message.author}[bot]: {message.content.strip(n)}{caption}<|end_of_turn|>"""
176
  )
177
  else:
178
  f.write(
179
+ f"""GPT4 Correct {message.author}: {message.content.strip(n)}{caption}<|end_of_turn|>"""
180
  )
181
  else:
182
  with open(f"data/{guild_name}/{msgchannel_name}", "w") as f:
183
  if message.author.bot:
184
  f.write(
185
+ f"GPT4 Correct system: {sysp}<|end_of_turn|>GPT4 Correct {message.author}[bot]: {message.content}{caption}<|end_of_turn|>"
186
  )
187
  else:
188
  f.write(
189
+ f"GPT4 Correct system: {sysp}<|end_of_turn|>GPT4 Correct {message.author}: {message.content}{caption}<|end_of_turn|>"
190
  )
191
  with open(f"data/{guild_name}/{msgchannel_name}", "r") as f:
192
  context = f.read()