Skip to content
This repository was archived by the owner on Nov 2, 2025. It is now read-only.

Commit 03184e7

Browse files
committed
half fix
1 parent 99ac640 commit 03184e7

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

routes/moderation.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"user",
3131
"backup",
3232
"restore",
33+
"pfpreset"
3334
]
3435

3536

@@ -199,6 +200,27 @@ def console() -> tuple[dict[str, Any] | str, int]:
199200
conn.commit()
200201

201202
return "Notified the user!", 200
203+
case "pfpreset":
204+
if not is_perm_level(request.headers.get("Authorization"), ["admin"]):
205+
return "You do not have permission to run this command!", 401
206+
207+
# Run SQLITE command
208+
try:
209+
conn = util.make_connection()
210+
dsc_users = util.exec_query(conn, "select discord_id from users where discord_id != null") # nosec
211+
hub_users = util.exec_query(conn, "select github_id from users where github_id is not null") # nosec
212+
213+
for user in hub_users.all():
214+
util.exec_query(conn, f"update users set profile_icon = \"https://avatars.githubusercontent.com/u/{user[0]}\" where github_id = {user[0]}")
215+
conn.commit()
216+
# for user in dsc_users.all():
217+
# util.exec_query(conn, f"update from users set profile_icon = \"https://avatars.githubusercontent.com/u/{user["discord_id"]}\"")
218+
219+
220+
except sqlalchemy.exc.SQLAlchemyError as error:
221+
return "SQL Error: " + (" ".join(error.args)), 400
222+
else:
223+
return "Processed command!", 200
202224
return "Unknown command", 400
203225

204226

0 commit comments

Comments
 (0)