Spaces:
Paused
Paused
Captain Ezio
commited on
Commit
·
0319c8e
1
Parent(s):
137630d
Nothing major
Browse files
Powers/database/greetings_db.py
CHANGED
|
@@ -154,10 +154,10 @@ class Greetings(MongoDB):
|
|
| 154 |
"welcome_text": "Hey {first}, welcome to {chatname}!",
|
| 155 |
"welcome": True,
|
| 156 |
"goodbye": True,
|
| 157 |
-
"welcome_media":
|
| 158 |
-
"welcome_mtype":
|
| 159 |
-
"goodbye_media":
|
| 160 |
-
"goodbye_mtype":
|
| 161 |
}
|
| 162 |
self.insert_one(new_data)
|
| 163 |
LOGGER.info(f"Initialized Greetings Document for chat {self.chat_id}")
|
|
|
|
| 154 |
"welcome_text": "Hey {first}, welcome to {chatname}!",
|
| 155 |
"welcome": True,
|
| 156 |
"goodbye": True,
|
| 157 |
+
"welcome_media":False,
|
| 158 |
+
"welcome_mtype":False,
|
| 159 |
+
"goodbye_media":False,
|
| 160 |
+
"goodbye_mtype":False
|
| 161 |
}
|
| 162 |
self.insert_one(new_data)
|
| 163 |
LOGGER.info(f"Initialized Greetings Document for chat {self.chat_id}")
|
Powers/plugins/utils.py
CHANGED
|
@@ -228,7 +228,7 @@ async def github(_, m: Message):
|
|
| 228 |
username = username.split("/")[-1].strip("@")
|
| 229 |
URL = f"https://api.github.com/users/{username}"
|
| 230 |
try:
|
| 231 |
-
r =
|
| 232 |
except requests.exceptions.ConnectTimeout:
|
| 233 |
return await m.reply_text("request timeout")
|
| 234 |
except Exception as e:
|
|
@@ -236,7 +236,7 @@ async def github(_, m: Message):
|
|
| 236 |
if r.status_code != 200:
|
| 237 |
await m.reply_text(f"{username} this user is not available on github\nMake sure you have given correct username")
|
| 238 |
return
|
| 239 |
-
|
| 240 |
avtar = r.get("avatar_url", None)
|
| 241 |
url = r.get("html_url", None)
|
| 242 |
name = r.get("name", None)
|
|
@@ -294,6 +294,7 @@ def paste(content: str):
|
|
| 294 |
resp = resp_post(f"{BASE}api/documents", data=content)
|
| 295 |
if resp.status_code != 200:
|
| 296 |
return
|
|
|
|
| 297 |
return BASE + resp["result"]['key']
|
| 298 |
|
| 299 |
|
|
|
|
| 228 |
username = username.split("/")[-1].strip("@")
|
| 229 |
URL = f"https://api.github.com/users/{username}"
|
| 230 |
try:
|
| 231 |
+
r = resp_get(URL, timeout=5)
|
| 232 |
except requests.exceptions.ConnectTimeout:
|
| 233 |
return await m.reply_text("request timeout")
|
| 234 |
except Exception as e:
|
|
|
|
| 236 |
if r.status_code != 200:
|
| 237 |
await m.reply_text(f"{username} this user is not available on github\nMake sure you have given correct username")
|
| 238 |
return
|
| 239 |
+
r = r.json()
|
| 240 |
avtar = r.get("avatar_url", None)
|
| 241 |
url = r.get("html_url", None)
|
| 242 |
name = r.get("name", None)
|
|
|
|
| 294 |
resp = resp_post(f"{BASE}api/documents", data=content)
|
| 295 |
if resp.status_code != 200:
|
| 296 |
return
|
| 297 |
+
resp = resp.json()
|
| 298 |
return BASE + resp["result"]['key']
|
| 299 |
|
| 300 |
|