Skip to content

Commit

Permalink
Update Warnings.py
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahCxrest authored Dec 24, 2024
1 parent a4cf431 commit 31a410b
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions datamodels/Warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,25 @@ async def insert_warning(

try:
url_var = config("BASE_API_URL")
panel_url_var = config("PANEL_API_URL")
if url_var not in ["", None]:
async with aiohttp.ClientSession() as session:
async with session.get(
f"{url_var}/Internal/SyncCreatePunishment/{identifier}", headers={
"Authorization": config('INTERNAL_API_AUTH')
}):
pass
pass
if panel_url_var not in ["", None]:
# Print the final URL to the panel API
final_url = f"{panel_url_var}/{guild_id}/SyncCreatePunishment?ID={identifier}"
print(f"Final Panel URL: {final_url}")

async with aiohttp.ClientSession() as session:
async with session.post(
final_url, headers={
"X-Static-Token": config('PANEL_STATIC_AUTH')
}):
pass
except:
pass

Expand Down Expand Up @@ -394,13 +406,25 @@ async def remove_warning_by_snowflake(
if selected_item["Guild"] == (guild_id or selected_item["Guild"]):
try:
url_var = config("BASE_API_URL")
panel_url_var = config("PANEL_API_URL")
if url_var not in ["", None]:
async with aiohttp.ClientSession() as session:
async with session.get(
f"{url_var}/Internal/SyncDeletePunishment/{selected_item['_id']}", headers={
"Authorization": config('INTERNAL_API_AUTH')
}):
pass
pass
if panel_url_var not in ["", None]:
final_guild_id = guild_id or selected_item["Guild"]
final_url = f"{panel_url_var}/{final_guild_id}/SyncDeletePunishment?ID={selected_item['_id']}"
print(f"Final Panel URL: {final_url}")

async with aiohttp.ClientSession() as session:
async with session.delete(
final_url, headers={
"X-Static-Token": config('PANEL_STATIC_AUTH')
}):
pass
except ValueError:
pass
return await self.db.delete_one({"Snowflake": identifier})
Expand Down

0 comments on commit 31a410b

Please sign in to comment.