from uuid import uuid4 from datetime import datetime, timedelta import requests import json print('Bot starts working...') BOT_TOKEN = "6848674712:AAEKnm2nF27Mq3jtIgm4JAZlTl2IAHPhzwA" ADMIN = 5934725286 last_sent_time = None def inline_query(update): AUTHORIZED_USER_IDS = [5934725286, 5377327708, 5817420325, 1918582402, 699882662, 1257545168, 1753264718, 1203220311, 6955248384, 752492336, 1673876488, 650599868, 1732613271, 1180727254, 1309190580, 967340481, 5322473767, 6426386490, 1036831407] user_id = update['inline_query']['from']['id'] if user_id not in AUTHORIZED_USER_IDS: unauthorized_message = "*Contact* ➡️ @boot\_to\_root" results = [ { 'type': 'article', 'id': str(uuid4()), 'title': "Access denied!", 'input_message_content': { 'message_text': unauthorized_message, 'parse_mode': 'Markdown' } } ] send_unauthorized_access_alert(ADMIN, user_id) send_inline_query_message(update['inline_query']['id'], results) return voices = [ ("https://raw.githubusercontent.com/guys-voice/voices/main/1.ogg", "V.V.Putin"), ("https://raw.githubusercontent.com/guys-voice/voices/main/2.ogg", "Kulib qoydim sanga, shavkat"), ("https://raw.githubusercontent.com/guys-voice/voices/main/3.ogg", "Kulib qoydim"), ("https://raw.githubusercontent.com/guys-voice/voices/main/4.ogg", "Nima bu"), ("https://raw.githubusercontent.com/guys-voice/voices/main/5.ogg", "Temola pilot 1"), ("https://raw.githubusercontent.com/guys-voice/voices/main/6.ogg", "Bir marta yozding indamadim"), ("https://raw.githubusercontent.com/guys-voice/voices/main/7.ogg", "Yot hammang, yot"), ("https://raw.githubusercontent.com/guys-voice/voices/main/8.ogg", "Gazni pulini bering"), ("https://raw.githubusercontent.com/guys-voice/voices/main/9.ogg", "Yaxsh"), ("https://raw.githubusercontent.com/guys-voice/voices/main/10.ogg", "Ya uka chichyording"), ("https://raw.githubusercontent.com/guys-voice/voices/main/11.ogg", "Hate emas, maqsad unique bo'lish"), ("https://raw.githubusercontent.com/guys-voice/voices/main/12.ogg", "Ollo rozi bo'sin"), ("https://raw.githubusercontent.com/guys-voice/voices/main/13.ogg", "Cringe"), ("https://raw.githubusercontent.com/guys-voice/voices/main/14.ogg", "Cringe 2"), ("https://raw.githubusercontent.com/guys-voice/voices/main/15.ogg", "Tupoy odam qomadi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/16.ogg", "Sohib"), ("https://raw.githubusercontent.com/guys-voice/voices/main/17.ogg", "Sohib king"), ("https://raw.githubusercontent.com/guys-voice/voices/main/18.ogg", "Sohib bot"), ("https://raw.githubusercontent.com/guys-voice/voices/main/19.ogg", "Qilig'ing yoqmaydi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/20.ogg", "Qarameng"), ("https://raw.githubusercontent.com/guys-voice/voices/main/21.ogg", "Ohio"), ("https://raw.githubusercontent.com/guys-voice/voices/main/22.ogg", "Na mehr qoldi na oqibat"), ("https://raw.githubusercontent.com/guys-voice/voices/main/23.ogg", "Murdoch university"), ("https://raw.githubusercontent.com/guys-voice/voices/main/24.ogg", "Maqsad yoq albatta"), ("https://raw.githubusercontent.com/guys-voice/voices/main/25.ogg", "O bu mano nima o'zi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/26.ogg", "Abdu kesang tiqamiz"), ("https://raw.githubusercontent.com/guys-voice/voices/main/27.ogg", "Katta tezlik bilan"), ("https://raw.githubusercontent.com/guys-voice/voices/main/28.ogg", "Kim u"), ("https://raw.githubusercontent.com/guys-voice/voices/main/29.ogg", "Jiyaniim yopishtiraman"), ("https://raw.githubusercontent.com/guys-voice/voices/main/30.ogg", "Oh no Jahongii"), ("https://raw.githubusercontent.com/guys-voice/voices/main/31.ogg", "Eshikni oching, gazdan keldik"), ("https://raw.githubusercontent.com/guys-voice/voices/main/32.ogg", "Man sani dadangmanmi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/33.ogg", "Yomurod dadam o'ldiradiku"), ("https://raw.githubusercontent.com/guys-voice/voices/main/34.ogg", "Chilparchin, uzr so'rayman"), ("https://raw.githubusercontent.com/guys-voice/voices/main/35.ogg", "Yamon, tovushcha nima diyopti"), ("https://raw.githubusercontent.com/guys-voice/voices/main/36.ogg", "E bot bo'lopti Abdu"), ("https://raw.githubusercontent.com/guys-voice/voices/main/37.ogg", "Bir marta yozding indamadim"), ("https://raw.githubusercontent.com/guys-voice/voices/main/38.ogg", "Oh no cringe"), ("https://raw.githubusercontent.com/guys-voice/voices/main/39.ogg", "LOL 1"), ("https://raw.githubusercontent.com/guys-voice/voices/main/40.ogg", "Untitled"), ("https://raw.githubusercontent.com/guys-voice/voices/main/41.ogg", "Yemagan"), ("https://raw.githubusercontent.com/guys-voice/voices/main/42.ogg", "Ko'rsa yitalaydi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/43.ogg", "LOL 2"), ("https://raw.githubusercontent.com/guys-voice/voices/main/44.ogg", "Nima bu nima"), ("https://raw.githubusercontent.com/guys-voice/voices/main/45.ogg", "Cringe 3"), ("https://raw.githubusercontent.com/guys-voice/voices/main/46.ogg", "17 secs of bullying Abdu"), ("https://raw.githubusercontent.com/guys-voice/voices/main/47.ogg", "Goher nasihatlari"), ("https://raw.githubusercontent.com/guys-voice/voices/main/48.ogg", "Cringe 4"), ("https://raw.githubusercontent.com/guys-voice/voices/main/49.ogg", "Bichara"), ("https://raw.githubusercontent.com/guys-voice/voices/main/50.ogg", "Abduni bitta gapi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/51.ogg", "Abdu 106"), ("https://raw.githubusercontent.com/guys-voice/voices/main/52.ogg", "Uxlamoqchiman"), ("https://raw.githubusercontent.com/guys-voice/voices/main/53.ogg", "LOL 3"), ("https://raw.githubusercontent.com/guys-voice/voices/main/54.ogg", "LOL 4"), ("https://raw.githubusercontent.com/guys-voice/voices/main/55.ogg", "LOL 5"), # ("https://raw.githubusercontent.com/guys-voice/voices/main/56.ogg", "Shoxijon"), # BANNED BY AUTHOR ("https://raw.githubusercontent.com/guys-voice/voices/main/57.ogg", "Untitled"), ("https://raw.githubusercontent.com/guys-voice/voices/main/58.ogg", "Yaxshi, sohib sila"), # ("https://raw.githubusercontent.com/guys-voice/voices/main/59.ogg", "Massivni demanstratsiya qilaylik"), # BANNED BY AUTHOR # ("https://raw.githubusercontent.com/guys-voice/voices/main/60.ogg", "Yok"), # BANNED BY AUTHOR # ("https://raw.githubusercontent.com/guys-voice/voices/main/61.ogg", "Yolka"), # BANNED BY AUTHOR # ("https://raw.githubusercontent.com/guys-voice/voices/main/62.ogg", "Yaxshi, krisa"), # BANNED BY AUTHOR ("https://raw.githubusercontent.com/guys-voice/voices/main/63.ogg", "Mirkoff"), ("https://raw.githubusercontent.com/guys-voice/voices/main/64.ogg", "Untitled"), ("https://raw.githubusercontent.com/guys-voice/voices/main/65.ogg", "Kimdir yitiribti"), ("https://raw.githubusercontent.com/guys-voice/voices/main/66.ogg", "Untitled"), ("https://raw.githubusercontent.com/guys-voice/voices/main/67.ogg", "Mirko supuruvchi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/68.ogg", "Problem netu"), ("https://raw.githubusercontent.com/guys-voice/voices/main/69.ogg", "Ha"), ("https://raw.githubusercontent.com/guys-voice/voices/main/70.ogg", "Xo'sh 1"), ("https://raw.githubusercontent.com/guys-voice/voices/main/71.ogg", "Shoxa b*a"), ("https://raw.githubusercontent.com/guys-voice/voices/main/72.ogg", "Sui"), ("https://raw.githubusercontent.com/guys-voice/voices/main/73.ogg", "Yo murod, b*a"), ("https://raw.githubusercontent.com/guys-voice/voices/main/74.ogg", "Haaa 1"), ("https://raw.githubusercontent.com/guys-voice/voices/main/75.ogg", "Haaa 2"), ("https://raw.githubusercontent.com/guys-voice/voices/main/76.ogg", "Jahongir pakinul gruppe 1"), ("https://raw.githubusercontent.com/guys-voice/voices/main/77.ogg", "Murod sila"), ("https://raw.githubusercontent.com/guys-voice/voices/main/78.ogg", "Sabab yoq"), ("https://raw.githubusercontent.com/guys-voice/voices/main/79.ogg", "Jahongir pakinul gruppe 2"), ("https://raw.githubusercontent.com/guys-voice/voices/main/80.ogg", "Temola pilot 2"), ("https://raw.githubusercontent.com/guys-voice/voices/main/81.ogg", "Tezlash shoxa"), ("https://raw.githubusercontent.com/guys-voice/voices/main/82.ogg", "Ignor"), ("https://raw.githubusercontent.com/guys-voice/voices/main/83.ogg", "Wowo"), ("https://raw.githubusercontent.com/guys-voice/voices/main/84.ogg", "So'ra tualetga bo'sayam"), ("https://raw.githubusercontent.com/guys-voice/voices/main/85.ogg", "Yamon yegan"), ("https://raw.githubusercontent.com/guys-voice/voices/main/86.ogg", "Vote qilamiz"), ("https://raw.githubusercontent.com/guys-voice/voices/main/87.ogg", "Yo murod, mirko"), ("https://raw.githubusercontent.com/guys-voice/voices/main/88.ogg", "Iye mirko"), ("https://raw.githubusercontent.com/guys-voice/voices/main/89.ogg", "Ha xo'sh"), ("https://raw.githubusercontent.com/guys-voice/voices/main/90.ogg", "Jiyan zvezdasan"), # ("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) ("https://raw.githubusercontent.com/guys-voice/voices/main/92.ogg", "Bu hech nima bermaydi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/93.ogg", "Shavkat pakinul gruppe"), ("https://raw.githubusercontent.com/guys-voice/voices/main/94.ogg", "Yemadi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/95.ogg", "O sila"), ("https://raw.githubusercontent.com/guys-voice/voices/main/96.ogg", "Sanga shu yarashadi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/97.ogg", "Makkilladizla"), ("https://raw.githubusercontent.com/guys-voice/voices/main/98.ogg", "Maqtov yorlig'i"), ("https://raw.githubusercontent.com/guys-voice/voices/main/99.ogg", "LOL 6"), ("https://raw.githubusercontent.com/guys-voice/voices/main/100.ogg", "Bachala tez, tez"), ("https://raw.githubusercontent.com/guys-voice/voices/main/101.ogg", "DNA, yomayo"), ("https://raw.githubusercontent.com/guys-voice/voices/main/102.ogg", "Boshqasi bormi, tasha"), ("https://raw.githubusercontent.com/guys-voice/voices/main/103.ogg", "Abduni sotaman"), ("https://raw.githubusercontent.com/guys-voice/voices/main/104.ogg", "Ko'rganman buni, abdu"), ("https://raw.githubusercontent.com/guys-voice/voices/main/105.ogg", "Abdu tiqadi sani"), ("https://raw.githubusercontent.com/guys-voice/voices/main/106.ogg", "Raxmat, bilamiz"), ("https://raw.githubusercontent.com/guys-voice/voices/main/107.ogg", "Arqada o'tirib, oldindan olaymi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/108.ogg", "Qizlani arqasini olopti"), ("https://raw.githubusercontent.com/guys-voice/voices/main/109.ogg", "Yo murod"), ("https://raw.githubusercontent.com/guys-voice/voices/main/110.ogg", "S*koptimi jahon"), ("https://raw.githubusercontent.com/guys-voice/voices/main/111.ogg", "Shaxmat ko'ropti"), ("https://raw.githubusercontent.com/guys-voice/voices/main/112.ogg", "Qizig'i yoq, shukur"), ("https://raw.githubusercontent.com/guys-voice/voices/main/113.ogg", "Yoshda holi, yosh"), ("https://raw.githubusercontent.com/guys-voice/voices/main/114.ogg", "Shavkatni statistikasi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/115.ogg", "Abdu, o'zingdan ketma"), ("https://raw.githubusercontent.com/guys-voice/voices/main/116.ogg", "O' shuhrat"), ("https://raw.githubusercontent.com/guys-voice/voices/main/117.ogg", "Maqsad yoq, O'"), ("https://raw.githubusercontent.com/guys-voice/voices/main/118.ogg", "Mativatsion video ko'rdingmi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/119.ogg", "Unutamiz"), ("https://raw.githubusercontent.com/guys-voice/voices/main/120.ogg", "Bilmayman e"), ("https://raw.githubusercontent.com/guys-voice/voices/main/121.ogg", "Bo'lli raxmat e"), ("https://raw.githubusercontent.com/guys-voice/voices/main/122.ogg", "Jahon debatga nol"), ("https://raw.githubusercontent.com/guys-voice/voices/main/123.ogg", "N klassiko qachon"), ("https://raw.githubusercontent.com/guys-voice/voices/main/124.ogg", "Xo'sh 2"), ("https://raw.githubusercontent.com/guys-voice/voices/main/125.ogg", "Sabab yoq, baxti"), ("https://raw.githubusercontent.com/guys-voice/voices/main/126.ogg", "Toshkent sliv zonaku"), ("https://raw.githubusercontent.com/guys-voice/voices/main/127.ogg", "Nosni kayfi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/128.ogg", "Abdu, nachag'"), ("https://raw.githubusercontent.com/guys-voice/voices/main/129.ogg", "Xo'sh, variant beringla"), ("https://raw.githubusercontent.com/guys-voice/voices/main/130.ogg", "Abdu za*bat qilopti"), ("https://raw.githubusercontent.com/guys-voice/voices/main/131.ogg", "Nima bu, shoxa"), ("https://raw.githubusercontent.com/guys-voice/voices/main/132.ogg", "Mirko selfimi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/133.ogg", "Iy sohib jirkanch"), ("https://raw.githubusercontent.com/guys-voice/voices/main/134.ogg", "Gilos zo'r ekan"), ("https://raw.githubusercontent.com/guys-voice/voices/main/135.ogg", "Muzika nima diyopti"), ("https://raw.githubusercontent.com/guys-voice/voices/main/136.ogg", "Shavkat qo'shiqchi"), ("https://raw.githubusercontent.com/guys-voice/voices/main/137.ogg", "Jahon xeyter bo'ma 1"), ("https://raw.githubusercontent.com/guys-voice/voices/main/138.ogg", "Jahon xeyter bo'ma 2"), ] query = update['inline_query']['query'].lower() filtered_voices = [(url, title) for url, title in voices if query in title.lower()] offset = int(update['inline_query']['offset']) if update['inline_query']['offset'] and update['inline_query']['offset'] != 'null' else 0 next_offset = str(offset + 20) if offset + 20 < len(voices) else '' results = [] if user_id == ADMIN: caption = '෴' else: caption = '#Fil' for voice_url, title in filtered_voices[offset:offset+20]: results.append({ 'id': str(uuid4()), 'voice_url': voice_url, 'title': title, 'type': 'voice' #, #'caption': caption (caption function doesnot work as expected) }) send_inline_query_results(update['inline_query']['id'], results, next_offset) send_audio_access_notification(ADMIN, user_id) def send_inline_query_message(inline_query_id, results): url = f"https://api.telegram.org/bot{BOT_TOKEN}/answerInlineQuery" data = { 'inline_query_id': inline_query_id, 'results': json.dumps(results) } requests.post(url, data=data) def send_audio_access_notification(chat_id, user_id): global last_sent_time now = datetime.now() if last_sent_time and now - last_sent_time < timedelta(minutes=1): return url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage" text = f"Authorized use. ID: {user_id}" data = { 'chat_id': chat_id, 'text': text } response = requests.post(url, data=data) if response.status_code == 200: last_sent_time = now else: print(f"Failed to send notification: {response.content}") def send_unauthorized_access_alert(chat_id, unauthorized_user_id): global last_sent_time now = datetime.now() if last_sent_time and now - last_sent_time < timedelta(minutes=1): return url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage" text = f"Unauthorized use has been detected! ID: {unauthorized_user_id}" data = { 'chat_id': chat_id, 'text': text } response = requests.post(url, data=data) if response.status_code == 200: last_sent_time = now else: print(f"Failed to send alert: {response.content}") def send_inline_query_results(inline_query_id, results, offset): url = f"https://api.telegram.org/bot{BOT_TOKEN}/answerInlineQuery" data = { 'inline_query_id': inline_query_id, 'results': results, 'next_offset': offset } headers = { 'Content-Type': 'application/json' } requests.post(url, json=data, headers=headers) def process_update(update): if 'inline_query' in update: inline_query(update) return 0 def main(): while True: updates = get_updates() for update in updates: process_update(update) def get_updates(): url = f"https://api.telegram.org/bot{BOT_TOKEN}/getUpdates" response = requests.get(url) if response.status_code == 200: return response.json()['result'] else: print(f"Error getting updates: {response.status_code}") return [] if __name__ == "__main__": main()