Skip to content

Commit

Permalink
Unblacklist hinzugefügt
Browse files Browse the repository at this point in the history
  • Loading branch information
bumseb1ene committed May 19, 2024
1 parent d490473 commit 20dca00
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions api_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,8 @@ def do_unban(self, steam_id):
unban_url = f"{self.base_url}/api/do_unban"
response = self.session.post(unban_url, json={'steam_id_64': steam_id})
return response.ok

def unblacklist_player(self, steam_id):
unban_url = f"{self.base_url}/api/unblacklist_player"
response = self.session.post(unban_url, json={'steam_id_64': steam_id})
return response.ok
13 changes: 8 additions & 5 deletions ban_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,16 @@ async def consume_unban_messages(connection, channel, queue, api_client):
try:
unban_data = json.loads(message.body.decode())
logging.info(f"Empfangene Unban-Daten: {unban_data}")
# Verwende do_unban Methode, um den Unban durchzuführen
# Führe do_unban und unblacklist_player aus
if api_client.do_unban(unban_data['steam_id_64']):
logging.info(f"Unban successful for steam_id_64: {unban_data['steam_id_64']}")
logging.info(f"Unban erfolgreich für steam_id_64: {unban_data['steam_id_64']}")
else:
logging.error(f"Unban operation failed for steam_id_64: {unban_data['steam_id_64']}")
logging.error(f"Unban-Vorgang fehlgeschlagen für steam_id_64: {unban_data['steam_id_64']}")

if api_client.unblacklist_player(unban_data['steam_id_64']):
logging.info(f"Player unblacklisted successfully for steam_id_64: {unban_data['steam_id_64']}")
else:
logging.error(f"Unblacklist operation failed for steam_id_64: {unban_data['steam_id_64']}")
except json.JSONDecodeError:
logging.error("Fehler beim Parsen der JSON-Daten")
await message.nack(requeue=True)
Expand Down Expand Up @@ -192,5 +197,3 @@ async def main():

if __name__ == '__main__':
asyncio.run(main())


0 comments on commit 20dca00

Please sign in to comment.