komiljon123 commited on
Commit
2d32b67
·
1 Parent(s): 345cf6d

Upload test.py

Browse files
Files changed (1) hide show
  1. test.py +280 -0
test.py ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from uuid import uuid4
2
+ from datetime import datetime, timedelta
3
+ import requests
4
+ import json
5
+ import cProfile
6
+
7
+ print('Bot starts working...')
8
+
9
+ BOT_TOKEN = "6814451088:AAER8hXynxfydKp9bV9E2U8XnE_KloqdqGc"
10
+ ADMIN = 5934725286
11
+ GROUP = 1635762236
12
+ last_sent_time = None
13
+ def inline_query(update):
14
+ AUTHORIZED_USER_IDS = [5934725286, 5377327708, 5817420325, 1918582402, 699882662, 1257545168, 1753264718, 1203220311, 6955248384, 752492336, 1673876488, 650599868, 1732613271, 1180727254, 1309190580, 967340481, 5322473767, 6426386490, 1036831407]
15
+ user_id = update['inline_query']['from']['id']
16
+ if user_id not in AUTHORIZED_USER_IDS:
17
+ unauthorized_message = "*Contact* ➡️ @boot\_to\_root"
18
+
19
+ results = [
20
+ {
21
+ 'type': 'article',
22
+ 'id': str(uuid4()),
23
+ 'title': "Access denied!",
24
+ 'input_message_content': {
25
+ 'message_text': unauthorized_message,
26
+ 'parse_mode': 'Markdown'
27
+ }
28
+ }
29
+ ]
30
+ send_unauthorized_access_alert(ADMIN, user_id)
31
+ send_inline_query_message(update['inline_query']['id'], results)
32
+ return
33
+ voices = [
34
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/1.ogg", "V.V.Putin"),
35
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/2.ogg", "Kulib qoydim sanga, shavkat"),
36
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/3.ogg", "Kulib qoydim"),
37
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/4.ogg", "Nima bu"),
38
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/5.ogg", "Temola pilot 1"),
39
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/6.ogg", "Bir marta yozding indamadim"),
40
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/7.ogg", "Yot hammang, yot"),
41
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/8.ogg", "Gazni pulini bering"),
42
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/9.ogg", "Yaxsh"),
43
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/10.ogg", "Ya uka chichyording"),
44
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/11.ogg", "Hate emas, maqsad unique bo'lish"),
45
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/12.ogg", "Ollo rozi bo'sin"),
46
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/13.ogg", "Cringe"),
47
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/14.ogg", "Cringe 2"),
48
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/15.ogg", "Tupoy odam qomadi"),
49
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/16.ogg", "Sohib"),
50
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/17.ogg", "Sohib king"),
51
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/18.ogg", "Sohib bot"),
52
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/19.ogg", "Qilig'ing yoqmaydi"),
53
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/20.ogg", "Qarameng"),
54
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/21.ogg", "Ohio"),
55
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/22.ogg", "Na mehr qoldi na oqibat"),
56
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/23.ogg", "Murdoch university"),
57
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/24.ogg", "Maqsad yoq albatta"),
58
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/25.ogg", "O bu mano nima o'zi"),
59
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/26.ogg", "Abdu kesang tiqamiz"),
60
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/27.ogg", "Katta tezlik bilan"),
61
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/28.ogg", "Kim u"),
62
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/29.ogg", "Jiyaniim yopishtiraman"),
63
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/30.ogg", "Oh no Jahongii"),
64
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/31.ogg", "Eshikni oching, gazdan keldik"),
65
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/32.ogg", "Man sani dadangmanmi"),
66
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/33.ogg", "Yomurod dadam o'ldiradiku"),
67
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/34.ogg", "Chilparchin, uzr so'rayman"),
68
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/35.ogg", "Yamon, tovushcha nima diyopti"),
69
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/36.ogg", "E bot bo'lopti Abdu"),
70
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/37.ogg", "Bir marta yozding indamadim"),
71
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/38.ogg", "Oh no cringe"),
72
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/39.ogg", "LOL 1"),
73
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/40.ogg", "Untitled"),
74
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/41.ogg", "Yemagan"),
75
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/42.ogg", "Ko'rsa yitalaydi"),
76
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/43.ogg", "LOL 2"),
77
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/44.ogg", "Nima bu nima"),
78
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/45.ogg", "Cringe 3"),
79
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/46.ogg", "17 secs of bullying Abdu"),
80
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/47.ogg", "Goher nasihatlari"),
81
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/48.ogg", "Cringe 4"),
82
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/49.ogg", "Bichara"),
83
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/50.ogg", "Abduni bitta gapi"),
84
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/51.ogg", "Abdu 106"),
85
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/52.ogg", "Uxlamoqchiman"),
86
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/53.ogg", "LOL 3"),
87
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/54.ogg", "LOL 4"),
88
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/55.ogg", "LOL 5"),
89
+ # ("https://raw.githubusercontent.com/guys-voice/voices/main/56.ogg", "Shoxijon"), # BANNED BY AUTHOR
90
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/57.ogg", "Untitled"),
91
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/58.ogg", "Yaxshi, sohib sila"),
92
+ # ("https://raw.githubusercontent.com/guys-voice/voices/main/59.ogg", "Massivni demanstratsiya qilaylik"), # BANNED BY AUTHOR
93
+ # ("https://raw.githubusercontent.com/guys-voice/voices/main/60.ogg", "Yok"), # BANNED BY AUTHOR
94
+ # ("https://raw.githubusercontent.com/guys-voice/voices/main/61.ogg", "Yolka"), # BANNED BY AUTHOR
95
+ # ("https://raw.githubusercontent.com/guys-voice/voices/main/62.ogg", "Yaxshi, krisa"), # BANNED BY AUTHOR
96
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/63.ogg", "Mirkoff"),
97
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/64.ogg", "Untitled"),
98
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/65.ogg", "Kimdir yitiribti"),
99
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/66.ogg", "Untitled"),
100
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/67.ogg", "Mirko supuruvchi"),
101
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/68.ogg", "Problem netu"),
102
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/69.ogg", "Ha"),
103
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/70.ogg", "Xo'sh 1"),
104
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/71.ogg", "Shoxa b*a"),
105
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/72.ogg", "Sui"),
106
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/73.ogg", "Yo murod, b*a"),
107
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/74.ogg", "Haaa 1"),
108
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/75.ogg", "Haaa 2"),
109
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/76.ogg", "Jahongir pakinul gruppe 1"),
110
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/77.ogg", "Murod sila"),
111
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/78.ogg", "Sabab yoq"),
112
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/79.ogg", "Jahongir pakinul gruppe 2"),
113
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/80.ogg", "Temola pilot 2"),
114
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/81.ogg", "Tezlash shoxa"),
115
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/82.ogg", "Ignor"),
116
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/83.ogg", "Wowo"),
117
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/84.ogg", "So'ra tualetga bo'sayam"),
118
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/85.ogg", "Yamon yegan"),
119
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/86.ogg", "Vote qilamiz"),
120
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/87.ogg", "Yo murod, mirko"),
121
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/88.ogg", "Iye mirko"),
122
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/89.ogg", "Ha xo'sh"),
123
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/90.ogg", "Jiyan zvezdasan"),
124
+ # ("https://raw.githubusercontent.com/guys-voice/voices/main/91.ogg", "Yemadi"), # DOES NOT WORK BY MISTAKE (I HAVE RUN THE PROGRAM BEFORE UPLOADING THE FILE)
125
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/92.ogg", "Bu hech nima bermaydi"),
126
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/93.ogg", "Shavkat pakinul gruppe"),
127
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/94.ogg", "Yemadi"),
128
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/95.ogg", "O sila"),
129
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/96.ogg", "Sanga shu yarashadi"),
130
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/97.ogg", "Makkilladizla"),
131
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/98.ogg", "Maqtov yorlig'i"),
132
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/99.ogg", "LOL 6"),
133
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/100.ogg", "Bachala tez, tez"),
134
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/101.ogg", "DNA, yomayo"),
135
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/102.ogg", "Boshqasi bormi, tasha"),
136
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/103.ogg", "Abduni sotaman"),
137
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/104.ogg", "Ko'rganman buni, abdu"),
138
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/105.ogg", "Abdu tiqadi sani"),
139
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/106.ogg", "Raxmat, bilamiz"),
140
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/107.ogg", "Arqada o'tirib, oldindan olaymi"),
141
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/108.ogg", "Qizlani arqasini olopti"),
142
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/109.ogg", "Yo murod"),
143
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/110.ogg", "S*koptimi jahon"),
144
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/111.ogg", "Shaxmat ko'ropti"),
145
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/112.ogg", "Qizig'i yoq, shukur"),
146
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/113.ogg", "Yoshda holi, yosh"),
147
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/114.ogg", "Shavkatni statistikasi"),
148
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/115.ogg", "Abdu, o'zingdan ketma"),
149
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/116.ogg", "O' shuhrat"),
150
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/117.ogg", "Maqsad yoq, O'"),
151
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/118.ogg", "Mativatsion video ko'rdingmi"),
152
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/119.ogg", "Unutamiz"),
153
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/120.ogg", "Bilmayman e"),
154
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/121.ogg", "Bo'lli raxmat e"),
155
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/122.ogg", "Jahon debatga nol"),
156
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/123.ogg", "N klassiko qachon"),
157
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/124.ogg", "Xo'sh 2"),
158
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/125.ogg", "Sabab yoq, baxti"),
159
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/126.ogg", "Toshkent sliv zonaku"),
160
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/127.ogg", "Nosni kayfi"),
161
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/128.ogg", "Abdu, nachag'"),
162
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/129.ogg", "Xo'sh, variant beringla"),
163
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/130.ogg", "Abdu za*bat qilopti"),
164
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/131.ogg", "Nima bu, shoxa"),
165
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/132.ogg", "Mirko selfimi"),
166
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/133.ogg", "Iy sohib jirkanch"),
167
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/134.ogg", "Gilos zo'r ekan"),
168
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/135.ogg", "Muzika nima diyopti"),
169
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/136.ogg", "Shavkat qo'shiqchi"),
170
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/137.ogg", "Jahon xeyter bo'ma 1"),
171
+ ("https://raw.githubusercontent.com/guys-voice/voices/main/138.ogg", "Jahon xeyter bo'ma 2"),
172
+
173
+
174
+ ]
175
+
176
+ query = update['inline_query']['query'].lower()
177
+ filtered_voices = [(url, title) for url, title in voices if query in title.lower()]
178
+
179
+ offset = int(update['inline_query']['offset']) if update['inline_query']['offset'] and update['inline_query']['offset'] != 'null' else 0
180
+ next_offset = str(offset + 20) if offset + 20 < len(voices) else ''
181
+
182
+ results = []
183
+
184
+ if user_id == ADMIN:
185
+ caption = '෴'
186
+ else:
187
+ caption = '#Fil'
188
+
189
+ for voice_url, title in filtered_voices[offset:offset+20]:
190
+ results.append({
191
+ 'id': str(uuid4()),
192
+ 'voice_url': voice_url,
193
+ 'title': title,
194
+ 'type': 'voice' #,
195
+ #'caption': caption (caption function doesnot work as expected)
196
+ })
197
+ send_inline_query_results(update['inline_query']['id'], results, next_offset)
198
+ send_audio_access_notification(ADMIN, user_id)
199
+
200
+ def send_inline_query_message(inline_query_id, results):
201
+ url = f"https://api.telegram.org/bot{BOT_TOKEN}/answerInlineQuery"
202
+ data = {
203
+ 'inline_query_id': inline_query_id,
204
+ 'results': json.dumps(results)
205
+ }
206
+ requests.post(url, data=data)
207
+
208
+ def send_audio_access_notification(chat_id, user_id):
209
+ global last_sent_time
210
+ now = datetime.now()
211
+
212
+ if last_sent_time and now - last_sent_time < timedelta(minutes=1):
213
+ return
214
+
215
+ url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage"
216
+ text = f"Authorized use. ID: {user_id}"
217
+ data = {
218
+ 'chat_id': chat_id,
219
+ 'text': text
220
+ }
221
+ response = requests.post(url, data=data)
222
+ requests.post(url, data={'chat_id': GROUP, 'text': "tezroq tanla."})
223
+ if response.status_code == 200:
224
+ last_sent_time = now
225
+ else:
226
+ print(f"Failed to send notification: {response.content}")
227
+
228
+ def send_unauthorized_access_alert(chat_id, unauthorized_user_id):
229
+ global last_sent_time
230
+ now = datetime.now()
231
+
232
+ if last_sent_time and now - last_sent_time < timedelta(minutes=1):
233
+ return
234
+
235
+ url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage"
236
+ text = f"Unauthorized use has been detected! ID: {unauthorized_user_id}"
237
+ data = {
238
+ 'chat_id': chat_id,
239
+ 'text': text
240
+ }
241
+ response = requests.post(url, data=data)
242
+ if response.status_code == 200:
243
+ last_sent_time = now
244
+ else:
245
+ print(f"Failed to send alert: {response.content}")
246
+
247
+ def send_inline_query_results(inline_query_id, results, offset):
248
+ url = f"https://api.telegram.org/bot{BOT_TOKEN}/answerInlineQuery"
249
+ data = {
250
+ 'inline_query_id': inline_query_id,
251
+ 'results': results,
252
+ 'next_offset': offset
253
+ }
254
+ headers = {
255
+ 'Content-Type': 'application/json'
256
+ }
257
+ requests.post(url, json=data, headers=headers)
258
+
259
+ def process_update(update):
260
+ if 'inline_query' in update:
261
+ inline_query(update)
262
+ return 0
263
+
264
+ def main():
265
+ while True:
266
+ updates = get_updates()
267
+ for update in updates:
268
+ process_update(update)
269
+
270
+ def get_updates():
271
+ url = f"https://api.telegram.org/bot{BOT_TOKEN}/getUpdates"
272
+ response = requests.get(url)
273
+ if response.status_code == 200:
274
+ return response.json()['result']
275
+ else:
276
+ print(f"Error getting updates: {response.status_code}")
277
+ return []
278
+
279
+ if __name__ == "__main__":
280
+ cProfile.run("main()")