Skip to content

Commit

Permalink
Temporarily removing Prohibited Key block
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeyUsersREC committed Mar 1, 2024
1 parent 41f3dcf commit 56c0e5a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 38 deletions.
24 changes: 0 additions & 24 deletions cogs/ERLC.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ async def erlc_message(self, ctx: commands.Context, *, message: str):
)
)
else:
if command_response[0] == 423:
return await ctx.send(
embed=discord.Embed(
title="Request Blocked",
description=f"This request from your server has been blocked.\nContact [ERM Support](https://discord.gg/BGfyfqU5fx) for details.\n**{command_response[1]['reason']}**",
color=BLANK_COLOR
)
)
return await ctx.send(
embed=discord.Embed(
title="Not Executed",
Expand Down Expand Up @@ -118,14 +110,6 @@ async def erlc_hint(self, ctx: commands.Context, *, hint: str):
)
)
else:
if command_response[0] == 423:
return await ctx.send(
embed=discord.Embed(
title="Request Blocked",
description=f"This request from your server has been blocked.\nContact [ERM Support](https://discord.gg/BGfyfqU5fx) for details.\n**{command_response[1]['reason']}**",
color=BLANK_COLOR
)
)
return await ctx.send(
embed=discord.Embed(
title="Not Executed",
Expand Down Expand Up @@ -230,14 +214,6 @@ async def server_send_command(self, ctx: commands.Context, *, command: str):
)
)
else:
if command_response[0] == 423:
return await ctx.send(
embed=discord.Embed(
title="Request Blocked",
description=f"This request from your server has been blocked.\nContact [ERM Support](https://discord.gg/BGfyfqU5fx) for details.\n**{command_response[1]['reason']}**",
color=BLANK_COLOR
)
)
return await ctx.send(
embed=discord.Embed(
title=f"Not Executed ({command_response[0]})",
Expand Down
22 changes: 8 additions & 14 deletions utils/prc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,26 +101,20 @@ async def _send_api_request(self, method: typing.Literal['GET', 'POST'], endpoin
else:
internal_server_key = key

if await self.bot.prohibited.db.count_documents({"ServerKey": internal_server_key, "ProhibitedUntil": {"$gt": int(datetime.datetime.now().timestamp())}}):
raise ResponseFailure(
status_code=423,
json_data={"reason": "Request Blocked - Key Prohibited | ERM Systems"}
)


async with self.session.request(method, url=f"{self.base_url}{endpoint}", headers={
"Authorization": self.api_key,
"Server-Key": internal_server_key
}, json=data or {}) as response:
if response.status == 403:
await self.bot.prohibited.insert({
"_id": ObjectId(),
"ServerKey": internal_server_key,
"ProhibitedUntil": 9999999999
})
response.status = 423
# if response.status == 403:
# await self.bot.prohibited.insert({
# "_id": ObjectId(),
# "ServerKey": internal_server_key,
# "ProhibitedUntil": 9999999999
# })
# response.status = 423

return response.status, ({"reason": "Request Blocked - Key Prohibited | ERM Systems"} if response.status == 423 else (await response.json() if response.content_type != "text/plain" else {}))
return response.status, (await response.json() if response.content_type != "text/plain" else {})


async def get_server_status(self, guild_id: int):
Expand Down

0 comments on commit 56c0e5a

Please sign in to comment.