Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -128,8 +128,9 @@ async def on_disconnect():
|
|
128 |
@client.event
|
129 |
async def on_message(message):
|
130 |
for user in message.mentions:
|
131 |
-
|
132 |
-
|
|
|
133 |
try:
|
134 |
msgchannel = message.channel
|
135 |
try:
|
@@ -138,7 +139,7 @@ async def on_message(message):
|
|
138 |
guild_name = guild.name
|
139 |
except:
|
140 |
guild_name = "Direct"
|
141 |
-
msgchannel_name = message.author
|
142 |
s = f":green[{message.author}]: :violet[{message.content}] :blue[{msgchannel_name}] :orange[{guild_name}]"
|
143 |
if message.author == client.user:
|
144 |
return
|
@@ -151,7 +152,8 @@ async def on_message(message):
|
|
151 |
If the user asks you to generate an image, use the start tag <|image|> and the end tag <|image|> around the prompt to generate it. Put this at the end of your response. Do not use a link for the image.
|
152 |
For example, if the user asks you to generate an image of a cat, you could say <|image|>A cute cat with long fur that is looking out a window with curious eyes, hd, realistic<|image|>
|
153 |
Always include a title.
|
154 |
-
Do not generate images unless the user speciifes that they want an image.
|
|
|
155 |
try:
|
156 |
os.mkdir("data/" + guild_name)
|
157 |
except:
|
@@ -159,14 +161,24 @@ async def on_message(message):
|
|
159 |
if os.path.exists(f"data/{guild_name}/{msgchannel_name}"):
|
160 |
with open(f"data/{guild_name}/{msgchannel_name}", "a") as f:
|
161 |
n = "\n"
|
162 |
-
|
163 |
-
f
|
164 |
-
|
|
|
|
|
|
|
|
|
|
|
165 |
else:
|
166 |
with open(f"data/{guild_name}/{msgchannel_name}", "w") as f:
|
167 |
-
|
168 |
-
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
170 |
with open(f"data/{guild_name}/{msgchannel_name}", "r") as f:
|
171 |
context = f.read()
|
172 |
if "Feeway" in guild_name:
|
@@ -203,7 +215,7 @@ async def on_message(message):
|
|
203 |
e = await message.reply(embed=embed)
|
204 |
if imgp != "":
|
205 |
np = """lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature"""
|
206 |
-
image = await
|
207 |
image.save("image.png")
|
208 |
embed.set_footer(
|
209 |
text=
|
|
|
128 |
@client.event
|
129 |
async def on_message(message):
|
130 |
for user in message.mentions:
|
131 |
+
if user.bot:
|
132 |
+
message.content = message.content.replace(f"<@{user.id}>",
|
133 |
+
f"<@{str(user)}[bot]>")
|
134 |
try:
|
135 |
msgchannel = message.channel
|
136 |
try:
|
|
|
139 |
guild_name = guild.name
|
140 |
except:
|
141 |
guild_name = "Direct"
|
142 |
+
msgchannel_name = str(message.author)
|
143 |
s = f":green[{message.author}]: :violet[{message.content}] :blue[{msgchannel_name}] :orange[{guild_name}]"
|
144 |
if message.author == client.user:
|
145 |
return
|
|
|
152 |
If the user asks you to generate an image, use the start tag <|image|> and the end tag <|image|> around the prompt to generate it. Put this at the end of your response. Do not use a link for the image.
|
153 |
For example, if the user asks you to generate an image of a cat, you could say <|image|>A cute cat with long fur that is looking out a window with curious eyes, hd, realistic<|image|>
|
154 |
Always include a title.
|
155 |
+
Do not generate images unless the user speciifes that they want an image.
|
156 |
+
If a user has [bot] next to their username, they are a bot."""
|
157 |
try:
|
158 |
os.mkdir("data/" + guild_name)
|
159 |
except:
|
|
|
161 |
if os.path.exists(f"data/{guild_name}/{msgchannel_name}"):
|
162 |
with open(f"data/{guild_name}/{msgchannel_name}", "a") as f:
|
163 |
n = "\n"
|
164 |
+
if message.author.bot:
|
165 |
+
f.write(
|
166 |
+
f"""GPT4 Correct {message.author}[bot]: {message.content.strip(n)}<|end_of_turn|>"""
|
167 |
+
)
|
168 |
+
else:
|
169 |
+
f.write(
|
170 |
+
f"""GPT4 Correct {message.author}: {message.content.strip(n)}<|end_of_turn|>"""
|
171 |
+
)
|
172 |
else:
|
173 |
with open(f"data/{guild_name}/{msgchannel_name}", "w") as f:
|
174 |
+
if message.author.bot:
|
175 |
+
f.write(
|
176 |
+
f"GPT4 Correct system: {sysp}<|end_of_turn|>GPT4 Correct {message.author}[bot]: {message.content}<|end_of_turn|>"
|
177 |
+
)
|
178 |
+
else:
|
179 |
+
f.write(
|
180 |
+
f"GPT4 Correct system: {sysp}<|end_of_turn|>GPT4 Correct {message.author}: {message.content}<|end_of_turn|>"
|
181 |
+
)
|
182 |
with open(f"data/{guild_name}/{msgchannel_name}", "r") as f:
|
183 |
context = f.read()
|
184 |
if "Feeway" in guild_name:
|
|
|
215 |
e = await message.reply(embed=embed)
|
216 |
if imgp != "":
|
217 |
np = """lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature"""
|
218 |
+
image = await SDT.text_to_image(imgp, negative_prompt=np)
|
219 |
image.save("image.png")
|
220 |
embed.set_footer(
|
221 |
text=
|