-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebhook.py
More file actions
45 lines (33 loc) · 1.03 KB
/
webhook.py
File metadata and controls
45 lines (33 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import requests
import time
token = "token_bot"
webhook_url = "https://yourdomain.com/bot.php"
api_url = f"https://botapi.rubika.ir/v3/{token}/updateBotEndpoints"
endpoints = [
"ReceiveUpdate",
"ReceiveInlineMessage",
"ReceiveQuery",
"GetSelectionItem",
"SearchSelectionItems"
]
headers = {
"Content-Type": "application/json"
}
print("setting up Rubika endpoints ...")
for endpoint in endpoints:
data = {
"url": webhook_url,
"type": endpoint
}
try:
response = requests.post(api_url, json=data, headers=headers, timeout=30).json()
print(f"{endpoint}:")
if response.get('status') == 'OK':
print(f" ✅ done - status: {response.get('data', {}).get('status', 'Unknown')}")
else:
print(f" ❌ error - response: {response}")
except Exception as e:
print(f"{endpoint}:")
print(f" ❌ error Network: {e}")
time.sleep(0.5)
print("the end!")