Skip to content

Commit

Permalink
_
Browse files Browse the repository at this point in the history
  • Loading branch information
xtsea authored Aug 31, 2024
1 parent 20b1119 commit 69207c1
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions RyuzakiLib/spamwatch/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,39 @@ def _make_request(method: str, url: str, params: dict = None, json_data: dict =
return None

@staticmethod
def ban(user_id: int = None, reason: str = None) -> str:
url = "https://akeno.randydev.my.id/sibylban"
def ban(user_id: int = None, reason: str = None, is_working_dev=False) -> str:
if is_working_dev:
url = "https://akeno.randydev.my.id/sibylban"
else:
url = "https://randydev-ryuzaki-api.hf.space/sibylban"
payload = {"user_id": user_id, "reason": reason}
response = SibylBan._make_request("POST", url, json_data=payload)
return response.get("randydev", {}).get(
"message", response.get("message", "Unknown error")
)

@staticmethod
def banlist(user_id: int = None) -> Union[dict, str]:
url = "https://akeno.randydev.my.id/ryuzaki/sibyl"
def banlist(user_id: int = None, is_working_dev=False) -> Union[dict, str]:
if is_working_dev:
url = "https://akeno.randydev.my.id/ryuzaki/sibyl"
else:
url = "https://randydev-ryuzaki-api.hf.space/ryuzaki/sibyl"
payload = {"user_id": user_id}
return SibylBan._make_request("GET", url, json_data=payload)

@staticmethod
def unban(user_id: int = None) -> Union[dict, str]:
url = "https://akeno.randydev.my.id/ryuzaki/sibyldel"
def unban(user_id: int = None, is_working_dev=False) -> Union[dict, str]:
if is_working_dev:
url = "https://akeno.randydev.my.id/ryuzaki/sibyldel"
else:
url = "https://randydev-ryuzaki-api.hf.space/ryuzaki/sibydel"
payload = {"user_id": user_id}
return SibylBan._make_request("DELETE", url, json_data=payload)

@staticmethod
def banlist_all() -> Union[dict, str]:
url = "https://akeno.randydev.my.id/ryuzaki/getbanlist"
def banlist_all(is_working_dev=False) -> Union[dict, str]:
if is_working_dev:
url = "https://akeno.randydev.my.id/ryuzaki/getbanlist"
else:
url = "https://randydev-ryuzaki-api.hf.space/ryuzaki/getbanlist"
return SibylBan._make_request("GET", url)

0 comments on commit 69207c1

Please sign in to comment.