Spaces:
Running
Running
File size: 17,758 Bytes
28a8cc9 | 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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | 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() |