Update main.py
Browse files
main.py
CHANGED
@@ -2,6 +2,7 @@ import logging
|
|
2 |
import time
|
3 |
import os
|
4 |
import requests
|
|
|
5 |
from pyrogram import *
|
6 |
from pyrogram.types import *
|
7 |
from pyrogram.errors import *
|
@@ -12,6 +13,7 @@ logging.basicConfig(
|
|
12 |
)
|
13 |
logging.getLogger("pyrogram").setLevel(logging.WARNING)
|
14 |
|
|
|
15 |
client = Client(
|
16 |
"Ryzenth",
|
17 |
api_id=API_ID,
|
@@ -75,21 +77,13 @@ We’re excited to have you here! Here’s what you can enjoy:
|
|
75 |
- **V1**: Free and unlimited access for all users.
|
76 |
- **V2**: Premium features with a 30-day free trial.
|
77 |
|
78 |
-
🚨 **Important Rules**:
|
79 |
-
To ensure a safe and fair environment for everyone, please adhere to the following rules:
|
80 |
-
1. **Prohibited Actions**:
|
81 |
-
- Exploiting or abusing the API for malicious purposes.
|
82 |
-
- Sharing API keys or credentials with unauthorized users.
|
83 |
-
- Violating any applicable laws or regulations.
|
84 |
-
|
85 |
-
2. **Consequences**:
|
86 |
-
- Breaking the rules will result in immediate suspension or banning.
|
87 |
-
- Harassment or misuse of the API will not be tolerated.
|
88 |
-
|
89 |
🔒 **Your Safety Matters**:
|
90 |
If you encounter any issues or feel harassed, please contact our support team immediately.
|
91 |
"""
|
92 |
|
|
|
|
|
|
|
93 |
@client.on_callback_query(filters.regex("^banyes_"))
|
94 |
async def cb_banned_nothing(client, query):
|
95 |
action = query.data.split("_", 1)[1]
|
@@ -192,7 +186,10 @@ async def cb_banned_and_key(client, query):
|
|
192 |
response = requests.post(
|
193 |
url,
|
194 |
params=params,
|
195 |
-
headers={
|
|
|
|
|
|
|
196 |
)
|
197 |
if response.status_code != 200:
|
198 |
return await query.answer("Error api try again", True)
|
@@ -225,7 +222,10 @@ async def cb_run_cohere(client, query):
|
|
225 |
response = requests.post(
|
226 |
url,
|
227 |
params={"user_id": user_id},
|
228 |
-
headers={
|
|
|
|
|
|
|
229 |
)
|
230 |
if response.status_code != 200:
|
231 |
return await query.answer("Error api try again", True)
|
@@ -234,7 +234,10 @@ async def cb_run_cohere(client, query):
|
|
234 |
if data_json.get("apiKey", False):
|
235 |
response_two = requests.get(
|
236 |
url_two,
|
237 |
-
headers={
|
|
|
|
|
|
|
238 |
params={"query": "hello world!"}
|
239 |
).json()
|
240 |
if response_two.get("results") is None:
|
@@ -250,7 +253,10 @@ async def cb_new_cohere(client, query):
|
|
250 |
response = requests.post(
|
251 |
url,
|
252 |
params={"user_id": user_id},
|
253 |
-
headers={
|
|
|
|
|
|
|
254 |
)
|
255 |
if response.status_code != 200:
|
256 |
return await query.answer("Error api try again", True)
|
@@ -295,7 +301,10 @@ async def cb_new_revokekey(client, query):
|
|
295 |
"user_id": user_id,
|
296 |
"username": query.from_user.username
|
297 |
},
|
298 |
-
headers={
|
|
|
|
|
|
|
299 |
)
|
300 |
response.raise_for_status()
|
301 |
data_json = response.json()
|
@@ -365,7 +374,10 @@ async def cb_new_keyprem(client, query):
|
|
365 |
response = requests.post(
|
366 |
url,
|
367 |
params={"user_id": user_id},
|
368 |
-
headers={
|
|
|
|
|
|
|
369 |
)
|
370 |
response.raise_for_status()
|
371 |
data_json = response.json()
|
@@ -440,11 +452,17 @@ async def cb_new_key(client, query):
|
|
440 |
"user_id": user_id,
|
441 |
"username": query.from_user.username
|
442 |
},
|
443 |
-
headers={
|
|
|
|
|
|
|
444 |
)
|
445 |
response_two = requests.get(
|
446 |
url_two,
|
447 |
-
headers={
|
|
|
|
|
|
|
448 |
)
|
449 |
response.raise_for_status()
|
450 |
response_two.raise_for_status()
|
|
|
2 |
import time
|
3 |
import os
|
4 |
import requests
|
5 |
+
import platform
|
6 |
from pyrogram import *
|
7 |
from pyrogram.types import *
|
8 |
from pyrogram.errors import *
|
|
|
13 |
)
|
14 |
logging.getLogger("pyrogram").setLevel(logging.WARNING)
|
15 |
|
16 |
+
|
17 |
client = Client(
|
18 |
"Ryzenth",
|
19 |
api_id=API_ID,
|
|
|
77 |
- **V1**: Free and unlimited access for all users.
|
78 |
- **V2**: Premium features with a 30-day free trial.
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
🔒 **Your Safety Matters**:
|
81 |
If you encounter any issues or feel harassed, please contact our support team immediately.
|
82 |
"""
|
83 |
|
84 |
+
def get_user_agent() -> str:
|
85 |
+
return f"Ryzenth/Python-{platform.python_version()}"
|
86 |
+
|
87 |
@client.on_callback_query(filters.regex("^banyes_"))
|
88 |
async def cb_banned_nothing(client, query):
|
89 |
action = query.data.split("_", 1)[1]
|
|
|
186 |
response = requests.post(
|
187 |
url,
|
188 |
params=params,
|
189 |
+
headers={
|
190 |
+
"User-Agent": get_user_agent(),
|
191 |
+
"x-api-key": os.environ.get("AKENOX_KEY")
|
192 |
+
}
|
193 |
)
|
194 |
if response.status_code != 200:
|
195 |
return await query.answer("Error api try again", True)
|
|
|
222 |
response = requests.post(
|
223 |
url,
|
224 |
params={"user_id": user_id},
|
225 |
+
headers={
|
226 |
+
"User-Agent": get_user_agent(),
|
227 |
+
"x-api-key": os.environ.get("AKENOX_KEY")
|
228 |
+
}
|
229 |
)
|
230 |
if response.status_code != 200:
|
231 |
return await query.answer("Error api try again", True)
|
|
|
234 |
if data_json.get("apiKey", False):
|
235 |
response_two = requests.get(
|
236 |
url_two,
|
237 |
+
headers={
|
238 |
+
"User-Agent": get_user_agent(),
|
239 |
+
"x-api-key": data_json["apiKey"]
|
240 |
+
},
|
241 |
params={"query": "hello world!"}
|
242 |
).json()
|
243 |
if response_two.get("results") is None:
|
|
|
253 |
response = requests.post(
|
254 |
url,
|
255 |
params={"user_id": user_id},
|
256 |
+
headers={
|
257 |
+
"User-Agent": get_user_agent(),
|
258 |
+
"x-api-key": os.environ.get("AKENOX_KEY")
|
259 |
+
}
|
260 |
)
|
261 |
if response.status_code != 200:
|
262 |
return await query.answer("Error api try again", True)
|
|
|
301 |
"user_id": user_id,
|
302 |
"username": query.from_user.username
|
303 |
},
|
304 |
+
headers={
|
305 |
+
"User-Agent": get_user_agent(),
|
306 |
+
"x-api-key": os.environ.get("AKENOX_KEY")
|
307 |
+
}
|
308 |
)
|
309 |
response.raise_for_status()
|
310 |
data_json = response.json()
|
|
|
374 |
response = requests.post(
|
375 |
url,
|
376 |
params={"user_id": user_id},
|
377 |
+
headers={
|
378 |
+
"User-Agent": get_user_agent(),
|
379 |
+
"x-api-key": os.environ.get("AKENOX_KEY")
|
380 |
+
}
|
381 |
)
|
382 |
response.raise_for_status()
|
383 |
data_json = response.json()
|
|
|
452 |
"user_id": user_id,
|
453 |
"username": query.from_user.username
|
454 |
},
|
455 |
+
headers={
|
456 |
+
"User-Agent": get_user_agent(),
|
457 |
+
"x-api-key": os.environ.get("AKENOX_KEY")
|
458 |
+
}
|
459 |
)
|
460 |
response_two = requests.get(
|
461 |
url_two,
|
462 |
+
headers={
|
463 |
+
"User-Agent": get_user_agent(),
|
464 |
+
"x-api-key": os.environ.get("AKENOX_KEY")
|
465 |
+
}
|
466 |
)
|
467 |
response.raise_for_status()
|
468 |
response_two.raise_for_status()
|