summaryrefslogtreecommitdiff
path: root/src/moyai_bot/apis/guzzle.py
diff options
context:
space:
mode:
authorseth <[email protected]>2023-01-10 00:21:10 -0500
committerseth <[email protected]>2023-01-10 00:21:10 -0500
commit3cd5709b00738d8f3b79f0892d978c18d302c2d1 (patch)
treea663a119d173378b41d985a67b3b6044ac2e3f73 /src/moyai_bot/apis/guzzle.py
parent365ee637180a15f7c3ebcb1a2553d021b3b74e1e (diff)
feat: add random teawie command
Diffstat (limited to 'src/moyai_bot/apis/guzzle.py')
-rw-r--r--src/moyai_bot/apis/guzzle.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/moyai_bot/apis/guzzle.py b/src/moyai_bot/apis/guzzle.py
new file mode 100644
index 0000000..67eb34d
--- /dev/null
+++ b/src/moyai_bot/apis/guzzle.py
@@ -0,0 +1,20 @@
+import requests
+
+GUZZLE: str = "https://guzzle.gay/api"
+
+
+def get_random_teawie() -> str:
+ resp: requests.Response = {}
+ try:
+ resp = requests.get(GUZZLE + "/get_random_teawie", timeout=30)
+ except (requests.RequestException, requests.ConnectionError,
+ requests.HTTPError, requests.JSONDecodeError):
+ return "something went wrong :("
+ if not resp.status_code == 200:
+ return "api request failed :("
+
+ try:
+ ret = resp.json()["url"]
+ except KeyError:
+ return "couldn't get url from api response :("
+ return ret