taslim19
commited on
Commit
·
5ca2077
1
Parent(s):
29fc22b
fix: always use valid SUPPORT_CHAT url for inline buttons and config improvements
Browse files- Devine/plugins/Dev/upload.py +9 -1
- config.py +9 -2
Devine/plugins/Dev/upload.py
CHANGED
@@ -29,12 +29,20 @@ async def upload_file(client, message, file_path):
|
|
29 |
|
30 |
with open(file_path, 'rb') as file:
|
31 |
files = {
|
32 |
-
"file": file
|
|
|
|
|
33 |
"api_key": API_KEY,
|
34 |
"timestamp": int(time.time()),
|
|
|
35 |
"signature": API_SECRET
|
36 |
}
|
37 |
response = requests.post(CLOUDINARY_UPLOAD_URL, data=files)
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
upload_time = round(time.time() - start_time, 2)
|
40 |
|
|
|
29 |
|
30 |
with open(file_path, 'rb') as file:
|
31 |
files = {
|
32 |
+
"file": file
|
33 |
+
}
|
34 |
+
data = {
|
35 |
"api_key": API_KEY,
|
36 |
"timestamp": int(time.time()),
|
37 |
+
<<<<<<< HEAD
|
38 |
"signature": API_SECRET
|
39 |
}
|
40 |
response = requests.post(CLOUDINARY_UPLOAD_URL, data=files)
|
41 |
+
=======
|
42 |
+
"signature": API_SECRET
|
43 |
+
}
|
44 |
+
response = requests.post(CLOUDINARY_UPLOAD_URL, files=files, data=data)
|
45 |
+
>>>>>>> c34e5bd (fix: always use valid SUPPORT_CHAT url for inline buttons and config improvements)
|
46 |
|
47 |
upload_time = round(time.time() - start_time, 2)
|
48 |
|
config.py
CHANGED
@@ -29,8 +29,8 @@ HEROKU_API_KEY = get_env_var("HEROKU_API_KEY", "")
|
|
29 |
UPSTREAM_REPO = get_env_var("UPSTREAM_REPO", "")
|
30 |
UPSTREAM_BRANCH = get_env_var("UPSTREAM_BRANCH", "main")
|
31 |
GIT_TOKEN = get_env_var("GIT_TOKEN", "")
|
32 |
-
SUPPORT_CHANNEL = get_env_var("SUPPORT_CHANNEL", "")
|
33 |
-
SUPPORT_CHAT = get_env_var("SUPPORT_CHAT", "")
|
34 |
AUTO_LEAVING_ASSISTANT = bool(get_env_var("AUTO_LEAVING_ASSISTANT", False))
|
35 |
SPOTIFY_CLIENT_ID = get_env_var("SPOTIFY_CLIENT_ID", "")
|
36 |
SPOTIFY_CLIENT_SECRET = get_env_var("SPOTIFY_CLIENT_SECRET", "")
|
@@ -74,6 +74,13 @@ def time_to_seconds(time):
|
|
74 |
|
75 |
DURATION_LIMIT = int(time_to_seconds(f"{DURATION_LIMIT_MIN}:00"))
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
if SUPPORT_CHANNEL:
|
78 |
if not re.match("(?:http|https)://", SUPPORT_CHANNEL):
|
79 |
raise SystemExit("[ERROR] - Your SUPPORT_CHANNEL url is wrong. Please ensure that it starts with https://")
|
|
|
29 |
UPSTREAM_REPO = get_env_var("UPSTREAM_REPO", "")
|
30 |
UPSTREAM_BRANCH = get_env_var("UPSTREAM_BRANCH", "main")
|
31 |
GIT_TOKEN = get_env_var("GIT_TOKEN", "")
|
32 |
+
SUPPORT_CHANNEL = get_env_var("SUPPORT_CHANNEL", "https://t.me/dragbots")
|
33 |
+
SUPPORT_CHAT = get_env_var("SUPPORT_CHAT", "https://t.me/dragbotsupport")
|
34 |
AUTO_LEAVING_ASSISTANT = bool(get_env_var("AUTO_LEAVING_ASSISTANT", False))
|
35 |
SPOTIFY_CLIENT_ID = get_env_var("SPOTIFY_CLIENT_ID", "")
|
36 |
SPOTIFY_CLIENT_SECRET = get_env_var("SPOTIFY_CLIENT_SECRET", "")
|
|
|
74 |
|
75 |
DURATION_LIMIT = int(time_to_seconds(f"{DURATION_LIMIT_MIN}:00"))
|
76 |
|
77 |
+
# Auto-fix missing scheme
|
78 |
+
if SUPPORT_CHAT and not SUPPORT_CHAT.startswith(("http://", "https://")):
|
79 |
+
SUPPORT_CHAT = "https://" + SUPPORT_CHAT
|
80 |
+
|
81 |
+
if SUPPORT_CHANNEL and not SUPPORT_CHANNEL.startswith(("http://", "https://")):
|
82 |
+
SUPPORT_CHANNEL = "https://" + SUPPORT_CHANNEL
|
83 |
+
|
84 |
if SUPPORT_CHANNEL:
|
85 |
if not re.match("(?:http|https)://", SUPPORT_CHANNEL):
|
86 |
raise SystemExit("[ERROR] - Your SUPPORT_CHANNEL url is wrong. Please ensure that it starts with https://")
|