Spaces:
Running
Running
File size: 147,963 Bytes
b00d2c6 |
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 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 |
# Kanged From @TroJanZheX
# Thanks @DeletedFromEarth
import asyncio
import re
import ast
import math
import random
import pytz
from datetime import datetime, timedelta, date, time
lock = asyncio.Lock()
from database.users_chats_db import db
from pyrogram.errors.exceptions.bad_request_400 import MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty
from Script import script
import pyrogram
from database.connections_mdb import active_connection, all_connections, delete_connection, if_active, make_active, \
make_inactive
from info import *
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery, InputMediaPhoto
from pyrogram import Client, filters, enums
from pyrogram.errors import FloodWait, UserIsBlocked, MessageNotModified, PeerIdInvalid
from utils import get_size, is_req_subscribed, get_poster, search_gagala, temp, get_settings, save_group_settings, get_shortlink, get_tutorial, send_all, get_cap
from database.users_chats_db import db
from database.ia_filterdb import Media, get_file_details, get_search_results, get_bad_files
from database.filters_mdb import (
del_all,
find_filter,
get_filters,
)
from database.gfilters_mdb import (
find_gfilter,
get_gfilters,
del_allg
)
import logging
from urllib.parse import quote_plus
from util.file_properties import get_name, get_hash, get_media_file_size
logger = logging.getLogger(__name__)
logger.setLevel(logging.ERROR)
import requests
import string
import tracemalloc
# Enable tracemalloc
tracemalloc.start()
TIMEZONE = "Asia/Kolkata"
BUTTON = {}
BUTTONS = {}
FRESH = {}
BUTTONS0 = {}
BUTTONS1 = {}
BUTTONS2 = {}
SPELL_CHECK = {}
# ENABLE_SHORTLINK = ""
def generate_random_alphanumeric():
"""Generate a random 8-letter alphanumeric string."""
characters = string.ascii_letters + string.digits
random_chars = ''.join(random.choice(characters) for _ in range(8))
return random_chars
def get_shortlink_sync(url):
try:
rget = requests.get(f"https://{STREAM_SITE}/api?api={STREAM_API}&url={url}&alias={generate_random_alphanumeric()}")
rjson = rget.json()
if rjson["status"] == "success" or rget.status_code == 200:
return rjson["shortenedUrl"]
else:
return url
except Exception as e:
print(f"Error in get_shortlink_sync: {e}")
return url
async def get_shortlink(url):
loop = asyncio.get_event_loop()
return await loop.run_in_executor(None, get_shortlink_sync, url)
@Client.on_message(filters.group | filters.private & filters.text & filters.incoming)
async def give_filter(client, message):
if message.chat.id != SUPPORT_CHAT_ID:
manual = await manual_filters(client, message)
if manual == False:
settings = await get_settings(message.chat.id)
try:
if settings['auto_ffilter']:
await auto_filter(client, message)
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_ffilter', True)
settings = await get_settings(message.chat.id)
if settings['auto_ffilter']:
await auto_filter(client, message)
else: #a better logic to avoid repeated lines of code in auto_filter function
search = message.text
temp_files, temp_offset, total_results = await get_search_results(chat_id=message.chat.id, query=search.lower(), offset=0, filter=True)
if total_results == 0:
return
else:
return await message.reply_text(f"<b>Hᴇʏ {message.from_user.mention},\n\nʏᴏᴜʀ ʀᴇǫᴜᴇꜱᴛ ɪꜱ ᴀʟʀᴇᴀᴅʏ ᴀᴠᴀɪʟᴀʙʟᴇ ✅\n\n📂 ꜰɪʟᴇꜱ ꜰᴏᴜɴᴅ : {str(total_results)}\n🔍 ꜱᴇᴀʀᴄʜ :</b> <code>{search}</code>\n\n<b>‼️ ᴛʜɪs ɪs ᴀ <u>sᴜᴘᴘᴏʀᴛ ɢʀᴏᴜᴘ</u> sᴏ ᴛʜᴀᴛ ʏᴏᴜ ᴄᴀɴ'ᴛ ɢᴇᴛ ғɪʟᴇs ғʀᴏᴍ ʜᴇʀᴇ...\n\n📝 ꜱᴇᴀʀᴄʜ ʜᴇʀᴇ : 👇</b>",
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("🔍 ᴊᴏɪɴ ᴀɴᴅ ꜱᴇᴀʀᴄʜ ʜᴇʀᴇ 🔎", url=f"https://t.me/MoviesLinkSearchBot2")]]))
@Client.on_message(filters.private & filters.text & filters.incoming)
async def pm_text(bot, message):
content = message.text
user = message.from_user.first_name
user_id = message.from_user.id
if content.startswith("/") or content.startswith("#"): return # ignore commands and hashtags
if user_id in ADMINS: return # ignore admins
await message.reply_text(
text=f"<b>ʜᴇʏ {user} 😍 ,\n\nʏᴏᴜ ᴄᴀɴ'ᴛ ɢᴇᴛ ᴍᴏᴠɪᴇs ꜰʀᴏᴍ ʜᴇʀᴇ. ʀᴇǫᴜᴇsᴛ ɪᴛ ɪɴ ᴏᴜʀ ᴍᴏᴠɪᴇ ɢʀᴏᴜᴘ ʙʏ ᴄʟɪᴄᴋɪɴɢ ᴏɴ ʙᴇʟᴏᴡ ʙᴜᴛᴛᴏɴ 👇</b>",
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("📝 ʀᴇǫᴜᴇsᴛ ʜᴇʀᴇ ", url=f"https://t.me/MoviesLinkSearchBot2")]])
)
await bot.send_message(
chat_id=LOG_CHANNEL,
text=f"<b>#𝐏𝐌_𝐌𝐒𝐆\n\nNᴀᴍᴇ : {user}\n\nID : {user_id}\n\nMᴇssᴀɢᴇ : {content}</b>"
)
@Client.on_callback_query(filters.regex(r"^next"))
async def next_page(bot, query):
ident, req, key, offset = query.data.split("_")
curr_time = datetime.now(pytz.timezone('Asia/Kolkata')).time()
if int(req) not in [query.from_user.id, 0]:
return await query.answer(script.ALRT_TXT.format(query.from_user.first_name), show_alert=True)
try:
offset = int(offset)
except:
offset = 0
if BUTTONS.get(key)!=None:
search = BUTTONS.get(key)
else:
search = FRESH.get(key)
if not search:
await query.answer(script.OLD_ALRT_TXT.format(query.from_user.first_name),show_alert=True)
return
files, n_offset, total = await get_search_results(query.message.chat.id, search, offset=offset, filter=True)
try:
n_offset = int(n_offset)
except:
n_offset = 0
if not files:
return
temp.GETALL[key] = files
temp.SHORT[query.from_user.id] = query.message.chat.id
settings = await get_settings(query.message.chat.id)
pre = 'filep' if settings['file_secure'] else 'file'
if settings['button']:
btn = [
[
InlineKeyboardButton(
text=f"📁 {get_size(file.file_size)} ▷ {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file.file_name.split()))}", callback_data=f'{pre}#{file.file_id}'
),
]
for file in files
]
btn.insert(0,
[
InlineKeyboardButton("⇈ ꜱᴇʟᴇᴄᴛ ᴏᴘᴛɪᴏɴꜱ ʜᴇʀᴇ ⇈", 'reqinfo')
]
)
btn.insert(0,
[
InlineKeyboardButton(f'ǫᴜᴀʟɪᴛʏ', callback_data=f"qualities#{key}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇ", callback_data=f"languages#{key}"),
InlineKeyboardButton("ꜱᴇᴀsᴏɴ", callback_data=f"seasons#{key}")
]
)
btn.insert(0, [
InlineKeyboardButton("♨️ ꜱᴇɴᴅ ᴀʟʟ ꜰɪʟᴇꜱ ♨️", callback_data=f"sendfiles#{key}")
])
else:
btn = []
btn.insert(0,
[
InlineKeyboardButton("⇈ ꜱᴇʟᴇᴄᴛ ᴏᴘᴛɪᴏɴꜱ ʜᴇʀᴇ ⇈", 'reqinfo')
]
)
btn.insert(0,
[
InlineKeyboardButton(f'ǫᴜᴀʟɪᴛʏ', callback_data=f"qualities#{key}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇ", callback_data=f"languages#{key}"),
InlineKeyboardButton("ꜱᴇᴀsᴏɴ", callback_data=f"seasons#{key}")
]
)
btn.insert(0, [
InlineKeyboardButton("♨️ ꜱᴇɴᴅ ᴀʟʟ ꜰɪʟᴇꜱ ♨️", callback_data=f"sendfiles#{key}")
])
try:
if settings['max_btn']:
if 0 < offset <= 10:
off_set = 0
elif offset == 0:
off_set = None
else:
off_set = offset - 10
if n_offset == 0:
btn.append(
[InlineKeyboardButton("⋞ ʙᴀᴄᴋ", callback_data=f"next_{req}_{key}_{off_set}"), InlineKeyboardButton(f"{math.ceil(int(offset)/10)+1} / {math.ceil(total/10)}", callback_data="pages")]
)
elif off_set is None:
btn.append([InlineKeyboardButton("ᴘᴀɢᴇ", callback_data="pages"), InlineKeyboardButton(f"{math.ceil(int(offset)/10)+1} / {math.ceil(total/10)}", callback_data="pages"), InlineKeyboardButton("ɴᴇxᴛ ⋟", callback_data=f"next_{req}_{key}_{n_offset}")])
else:
btn.append(
[
InlineKeyboardButton("⋞ ʙᴀᴄᴋ", callback_data=f"next_{req}_{key}_{off_set}"),
InlineKeyboardButton(f"{math.ceil(int(offset)/10)+1} / {math.ceil(total/10)}", callback_data="pages"),
InlineKeyboardButton("ɴᴇxᴛ ⋟", callback_data=f"next_{req}_{key}_{n_offset}")
],
)
else:
if 0 < offset <= int(MAX_B_TN):
off_set = 0
elif offset == 0:
off_set = None
else:
off_set = offset - int(MAX_B_TN)
if n_offset == 0:
btn.append(
[InlineKeyboardButton("⋞ ʙᴀᴄᴋ", callback_data=f"next_{req}_{key}_{off_set}"), InlineKeyboardButton(f"{math.ceil(int(offset)/int(MAX_B_TN))+1} / {math.ceil(total/int(MAX_B_TN))}", callback_data="pages")]
)
elif off_set is None:
btn.append([InlineKeyboardButton("ᴘᴀɢᴇ", callback_data="pages"), InlineKeyboardButton(f"{math.ceil(int(offset)/int(MAX_B_TN))+1} / {math.ceil(total/int(MAX_B_TN))}", callback_data="pages"), InlineKeyboardButton("ɴᴇxᴛ ⋟", callback_data=f"next_{req}_{key}_{n_offset}")])
else:
btn.append(
[
InlineKeyboardButton("⋞ ʙᴀᴄᴋ", callback_data=f"next_{req}_{key}_{off_set}"),
InlineKeyboardButton(f"{math.ceil(int(offset)/int(MAX_B_TN))+1} / {math.ceil(total/int(MAX_B_TN))}", callback_data="pages"),
InlineKeyboardButton("ɴᴇxᴛ ⋟", callback_data=f"next_{req}_{key}_{n_offset}")
],
)
except KeyError:
await save_group_settings(query.message.chat.id, 'max_btn', True)
if 0 < offset <= 10:
off_set = 0
elif offset == 0:
off_set = None
else:
off_set = offset - 10
if n_offset == 0:
btn.append(
[InlineKeyboardButton("⋞ ʙᴀᴄᴋ", callback_data=f"next_{req}_{key}_{off_set}"), InlineKeyboardButton(f"{math.ceil(int(offset)/10)+1} / {math.ceil(total/10)}", callback_data="pages")]
)
elif off_set is None:
btn.append([InlineKeyboardButton("ᴘᴀɢᴇ", callback_data="pages"), InlineKeyboardButton(f"{math.ceil(int(offset)/10)+1} / {math.ceil(total/10)}", callback_data="pages"), InlineKeyboardButton("ɴᴇxᴛ ⋟", callback_data=f"next_{req}_{key}_{n_offset}")])
else:
btn.append(
[
InlineKeyboardButton("⋞ ʙᴀᴄᴋ", callback_data=f"next_{req}_{key}_{off_set}"),
InlineKeyboardButton(f"{math.ceil(int(offset)/10)+1} / {math.ceil(total/10)}", callback_data="pages"),
InlineKeyboardButton("ɴᴇxᴛ ⋟", callback_data=f"next_{req}_{key}_{n_offset}")
],
)
if not settings["button"]:
cur_time = datetime.now(pytz.timezone('Asia/Kolkata')).time()
time_difference = timedelta(hours=cur_time.hour, minutes=cur_time.minute, seconds=(cur_time.second+(cur_time.microsecond/1000000))) - timedelta(hours=curr_time.hour, minutes=curr_time.minute, seconds=(curr_time.second+(curr_time.microsecond/1000000)))
remaining_seconds = "{:.2f}".format(time_difference.total_seconds())
cap = await get_cap(settings, remaining_seconds, files, query, total, search)
try:
await query.message.edit_text(text=cap, reply_markup=InlineKeyboardMarkup(btn), disable_web_page_preview=True)
except MessageNotModified:
pass
else:
try:
await query.edit_message_reply_markup(
reply_markup=InlineKeyboardMarkup(btn)
)
except MessageNotModified:
pass
await query.answer()
@Client.on_callback_query(filters.regex(r"^spol"))
async def advantage_spoll_choker(bot, query):
_, user, movie_ = query.data.split('#')
movies = SPELL_CHECK.get(query.message.reply_to_message.id)
if not movies:
return await query.answer(script.OLD_ALRT_TXT.format(query.from_user.first_name), show_alert=True)
if int(user) != 0 and query.from_user.id != int(user):
return await query.answer(script.ALRT_TXT.format(query.from_user.first_name), show_alert=True)
if movie_ == "close_spellcheck":
return await query.message.delete()
movie = movies[(int(movie_))]
movie = re.sub(r"[:\-]", " ", movie)
movie = re.sub(r"\s+", " ", movie).strip()
await query.answer(script.TOP_ALRT_MSG)
gl = await global_filters(bot, query.message, text=movie)
if gl == False:
k = await manual_filters(bot, query.message, text=movie)
if k == False:
files, offset, total_results = await get_search_results(query.message.chat.id, movie, offset=0, filter=True)
if files:
k = (movie, files, offset, total_results)
await auto_filter(bot, query, k)
else:
reqstr1 = query.from_user.id if query.from_user else 0
reqstr = await bot.get_users(reqstr1)
if NO_RESULTS_MSG:
await bot.send_message(chat_id=LOG_CHANNEL, text=(script.NORSLTS.format(reqstr.id, reqstr.mention, movie)))
k = await query.message.edit(script.MVE_NT_FND)
await asyncio.sleep(10)
await k.delete()
#Qualities
@Client.on_callback_query(filters.regex(r"^qualities#"))
async def qualities_cb_handler(client: Client, query: CallbackQuery):
try:
if int(query.from_user.id) not in [query.message.reply_to_message.from_user.id, 0]:
return await query.answer(
f"⚠️ ʜᴇʟʟᴏ {query.from_user.first_name},\nᴛʜɪꜱ ɪꜱ ɴᴏᴛ ʏᴏᴜʀ ᴍᴏᴠɪᴇ ʀᴇǫᴜᴇꜱᴛ,\nʀᴇǫᴜᴇꜱᴛ ʏᴏᴜʀ'ꜱ...",
show_alert=True,
)
except:
pass
_, key = query.data.split("#")
# if BUTTONS.get(key+"1")!=None:
# search = BUTTONS.get(key+"1")
# else:
# search = BUTTONS.get(key)
# BUTTONS[key+"1"] = search
search = FRESH.get(key)
search = search.replace(' ', '_')
btn = []
for i in range(0, len(QUALITIES)-1, 2):
btn.append([
InlineKeyboardButton(
text=QUALITIES[i].title(),
callback_data=f"fq#{QUALITIES[i].lower()}#{key}"
),
InlineKeyboardButton(
text=QUALITIES[i+1].title(),
callback_data=f"fq#{QUALITIES[i+1].lower()}#{key}"
),
])
btn.insert(
0,
[
InlineKeyboardButton(
text="⇊ ꜱᴇʟᴇᴄᴛ ǫᴜᴀʟɪᴛʏ ⇊", callback_data="ident"
)
],
)
req = query.from_user.id
offset = 0
btn.append([InlineKeyboardButton(text="↭ ʙᴀᴄᴋ ᴛᴏ ꜰɪʟᴇs ↭", callback_data=f"fq#homepage#{key}")])
await query.edit_message_reply_markup(InlineKeyboardMarkup(btn))
@Client.on_callback_query(filters.regex(r"^fq#"))
async def filter_qualities_cb_handler(client: Client, query: CallbackQuery):
_, qual, key = query.data.split("#")
curr_time = datetime.now(pytz.timezone('Asia/Kolkata')).time()
search = FRESH.get(key)
search = search.replace("_", " ")
baal = qual in search
if baal:
search = search.replace(qual, "")
else:
search = search
req = query.from_user.id
chat_id = query.message.chat.id
message = query.message
try:
if int(query.from_user.id) not in [query.message.reply_to_message.from_user.id, 0]:
return await query.answer(
f"⚠️ ʜᴇʟʟᴏ {query.from_user.first_name},\nᴛʜɪꜱ ɪꜱ ɴᴏᴛ ʏᴏᴜʀ ᴍᴏᴠɪᴇ ʀᴇǫᴜᴇꜱᴛ,\nʀᴇǫᴜᴇꜱᴛ ʏᴏᴜʀ'ꜱ...",
show_alert=True,
)
except:
pass
if qual != "homepage":
search = f"{search} {qual}"
BUTTONS[key] = search
files, offset, total_results = await get_search_results(chat_id, search, offset=0, filter=True)
if not files:
await query.answer("🚫 ɴᴏ ꜰɪʟᴇꜱ ᴡᴇʀᴇ ꜰᴏᴜɴᴅ 🚫", show_alert=1)
return
temp.GETALL[key] = files
settings = await get_settings(message.chat.id)
pre = 'filep' if settings['file_secure'] else 'file'
if settings["button"]:
btn = [
[
InlineKeyboardButton(
text=f"📁 {get_size(file.file_size)} ▷ {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file.file_name.split()))}", callback_data=f'{pre}#{file.file_id}'
),
]
for file in files
]
btn.insert(0,
[
InlineKeyboardButton("⇈ ꜱᴇʟᴇᴄᴛ ᴏᴘᴛɪᴏɴꜱ ʜᴇʀᴇ ⇈", 'reqinfo')
]
)
btn.insert(0,
[
InlineKeyboardButton(f'ǫᴜᴀʟɪᴛʏ', callback_data=f"qualities#{key}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇ", callback_data=f"languages#{key}"),
InlineKeyboardButton("ꜱᴇᴀsᴏɴ", callback_data=f"seasons#{key}")
]
)
btn.insert(0, [
InlineKeyboardButton("♨️ ꜱᴇɴᴅ ᴀʟʟ ꜰɪʟᴇꜱ ♨️", callback_data=f"sendfiles#{key}")
])
else:
btn = []
btn.insert(0,
[
InlineKeyboardButton("⇈ ꜱᴇʟᴇᴄᴛ ᴏᴘᴛɪᴏɴꜱ ʜᴇʀᴇ ⇈", 'reqinfo')
]
)
btn.insert(0,
[
InlineKeyboardButton(f'ǫᴜᴀʟɪᴛʏ', callback_data=f"qualities#{key}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇ", callback_data=f"languages#{key}"),
InlineKeyboardButton("ꜱᴇᴀsᴏɴ", callback_data=f"seasons#{key}")
]
)
btn.insert(0, [
InlineKeyboardButton("♨️ ꜱᴇɴᴅ ᴀʟʟ ꜰɪʟᴇꜱ ♨️", callback_data=f"sendfiles#{key}")
])
if offset != "":
try:
if settings['max_btn']:
btn.append(
[InlineKeyboardButton("ᴘᴀɢᴇ", callback_data="pages"), InlineKeyboardButton(text=f"1/{math.ceil(int(total_results)/10)}",callback_data="pages"), InlineKeyboardButton(text="ɴᴇxᴛ ⋟",callback_data=f"next_{req}_{key}_{offset}")]
)
else:
btn.append(
[InlineKeyboardButton("ᴘᴀɢᴇ", callback_data="pages"), InlineKeyboardButton(text=f"1/{math.ceil(int(total_results)/int(MAX_B_TN))}",callback_data="pages"), InlineKeyboardButton(text="ɴᴇxᴛ ⋟",callback_data=f"next_{req}_{key}_{offset}")]
)
except KeyError:
await save_group_settings(query.message.chat.id, 'max_btn', True)
btn.append(
[InlineKeyboardButton("ᴘᴀɢᴇ", callback_data="pages"), InlineKeyboardButton(text=f"1/{math.ceil(int(total_results)/10)}",callback_data="pages"), InlineKeyboardButton(text="ɴᴇxᴛ ⋟",callback_data=f"next_{req}_{key}_{offset}")]
)
else:
btn.append(
[InlineKeyboardButton(text="↭ ɴᴏ ᴍᴏʀᴇ ᴘᴀɢᴇꜱ ᴀᴠᴀɪʟᴀʙʟᴇ ↭",callback_data="pages")]
)
if not settings["button"]:
cur_time = datetime.now(pytz.timezone('Asia/Kolkata')).time()
time_difference = timedelta(hours=cur_time.hour, minutes=cur_time.minute, seconds=(cur_time.second+(cur_time.microsecond/1000000))) - timedelta(hours=curr_time.hour, minutes=curr_time.minute, seconds=(curr_time.second+(curr_time.microsecond/1000000)))
remaining_seconds = "{:.2f}".format(time_difference.total_seconds())
cap = await get_cap(settings, remaining_seconds, files, query, total_results, search)
try:
await query.message.edit_text(text=cap, reply_markup=InlineKeyboardMarkup(btn), disable_web_page_preview=True)
except MessageNotModified:
pass
else:
try:
await query.edit_message_reply_markup(
reply_markup=InlineKeyboardMarkup(btn)
)
except MessageNotModified:
pass
await query.answer()
#languages
@Client.on_callback_query(filters.regex(r"^languages#"))
async def languages_cb_handler(client: Client, query: CallbackQuery):
try:
if int(query.from_user.id) not in [query.message.reply_to_message.from_user.id, 0]:
return await query.answer(
f"⚠️ ʜᴇʟʟᴏ {query.from_user.first_name},\nᴛʜɪꜱ ɪꜱ ɴᴏᴛ ʏᴏᴜʀ ᴍᴏᴠɪᴇ ʀᴇǫᴜᴇꜱᴛ,\nʀᴇǫᴜᴇꜱᴛ ʏᴏᴜʀ'ꜱ...",
show_alert=True,
)
except:
pass
_, key = query.data.split("#")
# if BUTTONS.get(key+"1")!=None:
# search = BUTTONS.get(key+"1")
# else:
# search = BUTTONS.get(key)
# BUTTONS[key+"1"] = search
search = FRESH.get(key)
search = search.replace(' ', '_')
btn = []
for i in range(0, len(LANGUAGES)-1, 2):
btn.append([
InlineKeyboardButton(
text=LANGUAGES[i].title(),
callback_data=f"fl#{LANGUAGES[i].lower()}#{key}"
),
InlineKeyboardButton(
text=LANGUAGES[i+1].title(),
callback_data=f"fl#{LANGUAGES[i+1].lower()}#{key}"
),
])
btn.insert(
0,
[
InlineKeyboardButton(
text="⇊ ꜱᴇʟᴇᴄᴛ ʟᴀɴɢᴜᴀɢᴇ ⇊", callback_data="ident"
)
],
)
req = query.from_user.id
offset = 0
btn.append([InlineKeyboardButton(text="↭ ʙᴀᴄᴋ ᴛᴏ ꜰɪʟᴇs ↭", callback_data=f"fl#homepage#{key}")])
await query.edit_message_reply_markup(InlineKeyboardMarkup(btn))
@Client.on_callback_query(filters.regex(r"^fl#"))
async def filter_languages_cb_handler(client: Client, query: CallbackQuery):
_, lang, key = query.data.split("#")
curr_time = datetime.now(pytz.timezone('Asia/Kolkata')).time()
search = FRESH.get(key)
search = search.replace("_", " ")
baal = lang in search
if baal:
search = search.replace(lang, "")
else:
search = search
req = query.from_user.id
chat_id = query.message.chat.id
message = query.message
try:
if int(query.from_user.id) not in [query.message.reply_to_message.from_user.id, 0]:
return await query.answer(
f"⚠️ ʜᴇʟʟᴏ {query.from_user.first_name},\nᴛʜɪꜱ ɪꜱ ɴᴏᴛ ʏᴏᴜʀ ᴍᴏᴠɪᴇ ʀᴇǫᴜᴇꜱᴛ,\nʀᴇǫᴜᴇꜱᴛ ʏᴏᴜʀ'ꜱ...",
show_alert=True,
)
except:
pass
if lang != "homepage":
search = f"{search} {lang}"
BUTTONS[key] = search
files, offset, total_results = await get_search_results(chat_id, search, offset=0, filter=True)
if not files:
await query.answer("🚫 ɴᴏ ꜰɪʟᴇꜱ ᴡᴇʀᴇ ꜰᴏᴜɴᴅ 🚫", show_alert=1)
return
temp.GETALL[key] = files
settings = await get_settings(message.chat.id)
pre = 'filep' if settings['file_secure'] else 'file'
if settings["button"]:
btn = [
[
InlineKeyboardButton(
text=f"📁 {get_size(file.file_size)} ▷ {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file.file_name.split()))}", callback_data=f'{pre}#{file.file_id}'
),
]
for file in files
]
btn.insert(0,
[
InlineKeyboardButton("⇈ ꜱᴇʟᴇᴄᴛ ᴏᴘᴛɪᴏɴꜱ ʜᴇʀᴇ ⇈", 'reqinfo')
]
)
btn.insert(0,
[
InlineKeyboardButton(f'ǫᴜᴀʟɪᴛʏ', callback_data=f"qualities#{key}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇ", callback_data=f"languages#{key}"),
InlineKeyboardButton("ꜱᴇᴀsᴏɴ", callback_data=f"seasons#{key}")
]
)
btn.insert(0, [
InlineKeyboardButton("♨️ ꜱᴇɴᴅ ᴀʟʟ ꜰɪʟᴇꜱ ♨️", callback_data=f"sendfiles#{key}")
])
else:
btn = []
btn.insert(0,
[
InlineKeyboardButton("⇈ ꜱᴇʟᴇᴄᴛ ᴏᴘᴛɪᴏɴꜱ ʜᴇʀᴇ ⇈", 'reqinfo')
]
)
btn.insert(0,
[
InlineKeyboardButton(f'ǫᴜᴀʟɪᴛʏ', callback_data=f"qualities#{key}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇ", callback_data=f"languages#{key}"),
InlineKeyboardButton("ꜱᴇᴀsᴏɴ", callback_data=f"seasons#{key}")
]
)
btn.insert(0, [
InlineKeyboardButton("♨️ ꜱᴇɴᴅ ᴀʟʟ ꜰɪʟᴇꜱ ♨️", callback_data=f"sendfiles#{key}")
])
if offset != "":
try:
if settings['max_btn']:
btn.append(
[InlineKeyboardButton("ᴘᴀɢᴇ", callback_data="pages"), InlineKeyboardButton(text=f"1/{math.ceil(int(total_results)/10)}",callback_data="pages"), InlineKeyboardButton(text="ɴᴇxᴛ ⋟",callback_data=f"next_{req}_{key}_{offset}")]
)
else:
btn.append(
[InlineKeyboardButton("ᴘᴀɢᴇ", callback_data="pages"), InlineKeyboardButton(text=f"1/{math.ceil(int(total_results)/int(MAX_B_TN))}",callback_data="pages"), InlineKeyboardButton(text="ɴᴇxᴛ ⋟",callback_data=f"next_{req}_{key}_{offset}")]
)
except KeyError:
await save_group_settings(query.message.chat.id, 'max_btn', True)
btn.append(
[InlineKeyboardButton("ᴘᴀɢᴇ", callback_data="pages"), InlineKeyboardButton(text=f"1/{math.ceil(int(total_results)/10)}",callback_data="pages"), InlineKeyboardButton(text="ɴᴇxᴛ ⋟",callback_data=f"next_{req}_{key}_{offset}")]
)
else:
btn.append(
[InlineKeyboardButton(text="↭ ɴᴏ ᴍᴏʀᴇ ᴘᴀɢᴇꜱ ᴀᴠᴀɪʟᴀʙʟᴇ ↭",callback_data="pages")]
)
if not settings["button"]:
cur_time = datetime.now(pytz.timezone('Asia/Kolkata')).time()
time_difference = timedelta(hours=cur_time.hour, minutes=cur_time.minute, seconds=(cur_time.second+(cur_time.microsecond/1000000))) - timedelta(hours=curr_time.hour, minutes=curr_time.minute, seconds=(curr_time.second+(curr_time.microsecond/1000000)))
remaining_seconds = "{:.2f}".format(time_difference.total_seconds())
cap = await get_cap(settings, remaining_seconds, files, query, total_results, search)
try:
await query.message.edit_text(text=cap, reply_markup=InlineKeyboardMarkup(btn), disable_web_page_preview=True)
except MessageNotModified:
pass
else:
try:
await query.edit_message_reply_markup(
reply_markup=InlineKeyboardMarkup(btn)
)
except MessageNotModified:
pass
await query.answer()
@Client.on_callback_query(filters.regex(r"^seasons#"))
async def seasons_cb_handler(client: Client, query: CallbackQuery):
try:
if int(query.from_user.id) not in [query.message.reply_to_message.from_user.id, 0]:
return await query.answer(
f"⚠️ ʜᴇʟʟᴏ {query.from_user.first_name},\nᴛʜɪꜱ ɪꜱ ɴᴏᴛ ʏᴏᴜʀ ᴍᴏᴠɪᴇ ʀᴇǫᴜᴇꜱᴛ,\nʀᴇǫᴜᴇꜱᴛ ʏᴏᴜʀ'ꜱ...",
show_alert=True,
)
except:
pass
_, key = query.data.split("#")
# if BUTTONS.get(key+"2")!=None:
# search = BUTTONS.get(key+"2")
# else:
# search = BUTTONS.get(key)
# BUTTONS[key+"2"] = search
search = FRESH.get(key)
BUTTONS[key] = None
search = search.replace(' ', '_')
btn = []
for i in range(0, len(SEASONS)-1, 2):
btn.append([
InlineKeyboardButton(
text=SEASONS[i].title(),
callback_data=f"fs#{SEASONS[i].lower()}#{key}"
),
InlineKeyboardButton(
text=SEASONS[i+1].title(),
callback_data=f"fs#{SEASONS[i+1].lower()}#{key}"
),
])
btn.insert(
0,
[
InlineKeyboardButton(
text="⇊ ꜱᴇʟᴇᴄᴛ ꜱᴇᴀꜱᴏɴ ⇊", callback_data="ident"
)
],
)
req = query.from_user.id
offset = 0
btn.append([InlineKeyboardButton(text="↭ ʙᴀᴄᴋ ᴛᴏ ꜰɪʟᴇs ↭", callback_data=f"next_{req}_{key}_{offset}")])
await query.edit_message_reply_markup(InlineKeyboardMarkup(btn))
@Client.on_callback_query(filters.regex(r"^fs#"))
async def filter_seasons_cb_handler(client: Client, query: CallbackQuery):
_, seas, key = query.data.split("#")
curr_time = datetime.now(pytz.timezone('Asia/Kolkata')).time()
search = FRESH.get(key)
search = search.replace("_", " ")
sea = ""
season_search = ["s01","s02", "s03", "s04", "s05", "s06", "s07", "s08", "s09", "s10", "season 01","season 02","season 03","season 04","season 05","season 06","season 07","season 08","season 09","season 10", "season 1","season 2","season 3","season 4","season 5","season 6","season 7","season 8","season 9"]
for x in range (len(season_search)):
if season_search[x] in search:
sea = season_search[x]
break
if sea:
search = search.replace(sea, "")
else:
search = search
req = query.from_user.id
chat_id = query.message.chat.id
message = query.message
try:
if int(query.from_user.id) not in [query.message.reply_to_message.from_user.id, 0]:
return await query.answer(
f"⚠️ ʜᴇʟʟᴏ {query.from_user.first_name},\nᴛʜɪꜱ ɪꜱ ɴᴏᴛ ʏᴏᴜʀ ᴍᴏᴠɪᴇ ʀᴇǫᴜᴇꜱᴛ,\nʀᴇǫᴜᴇꜱᴛ ʏᴏᴜʀ'ꜱ...",
show_alert=True,
)
except:
pass
searchagn = search
search1 = search
search2 = search
search = f"{search} {seas}"
BUTTONS0[key] = search
files, _, _ = await get_search_results(chat_id, search, max_results=10)
files = [file for file in files if re.search(seas, file.file_name, re.IGNORECASE)]
seas1 = "s01" if seas == "season 1" else "s02" if seas == "season 2" else "s03" if seas == "season 3" else "s04" if seas == "season 4" else "s05" if seas == "season 5" else "s06" if seas == "season 6" else "s07" if seas == "season 7" else "s08" if seas == "season 8" else "s09" if seas == "season 9" else "s10" if seas == "season 10" else ""
search1 = f"{search1} {seas1}"
BUTTONS1[key] = search1
files1, _, _ = await get_search_results(chat_id, search1, max_results=10)
files1 = [file for file in files1 if re.search(seas1, file.file_name, re.IGNORECASE)]
if files1:
files.extend(files1)
seas2 = "season 01" if seas == "season 1" else "season 02" if seas == "season 2" else "season 03" if seas == "season 3" else "season 04" if seas == "season 4" else "season 05" if seas == "season 5" else "season 06" if seas == "season 6" else "season 07" if seas == "season 7" else "season 08" if seas == "season 8" else "season 09" if seas == "season 9" else "s010"
search2 = f"{search2} {seas2}"
BUTTONS2[key] = search2
files2, _, _ = await get_search_results(chat_id, search2, max_results=10)
files2 = [file for file in files2 if re.search(seas2, file.file_name, re.IGNORECASE)]
if files2:
files.extend(files2)
if not files:
await query.answer("🚫 ɴᴏ ꜰɪʟᴇꜱ ᴡᴇʀᴇ ꜰᴏᴜɴᴅ 🚫", show_alert=1)
return
temp.GETALL[key] = files
settings = await get_settings(message.chat.id)
pre = 'filep' if settings['file_secure'] else 'file'
if settings["button"]:
btn = [
[
InlineKeyboardButton(
text=f"📁 {get_size(file.file_size)} ▷ {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file.file_name.split()))}", callback_data=f'{pre}#{file.file_id}'
),
]
for file in files
]
btn.insert(0, [
InlineKeyboardButton("ꜱᴇɴᴅ ᴀʟʟ", callback_data=f"sendfiles#{key}"),
InlineKeyboardButton("ꜱᴇʟᴇᴄᴛ ᴀɢᴀɪɴ", callback_data=f"seasons#{key}")
])
else:
btn = []
btn.insert(0,
[
InlineKeyboardButton("⇈ ꜱᴇʟᴇᴄᴛ ᴏᴘᴛɪᴏɴꜱ ʜᴇʀᴇ ⇈", 'reqinfo')
]
)
btn.insert(0,
[
InlineKeyboardButton(f'ǫᴜᴀʟɪᴛʏ', callback_data=f"qualities#{key}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇ", callback_data=f"languages#{key}"),
InlineKeyboardButton("ꜱᴇᴀsᴏɴ", callback_data=f"seasons#{key}")
]
)
btn.insert(0, [
InlineKeyboardButton("♨️ ꜱᴇɴᴅ ᴀʟʟ ꜰɪʟᴇꜱ ♨️", callback_data=f"sendfiles#{key}")
])
offset = 0
btn.append([
InlineKeyboardButton(
text="↭ ʙᴀᴄᴋ ᴛᴏ ꜰɪʟᴇs ↭",
callback_data=f"next_{req}_{key}_{offset}"
),
])
if not settings["button"]:
cur_time = datetime.now(pytz.timezone('Asia/Kolkata')).time()
time_difference = timedelta(hours=cur_time.hour, minutes=cur_time.minute, seconds=(cur_time.second+(cur_time.microsecond/1000000))) - timedelta(hours=curr_time.hour, minutes=curr_time.minute, seconds=(curr_time.second+(curr_time.microsecond/1000000)))
remaining_seconds = "{:.2f}".format(time_difference.total_seconds())
total_results = len(files)
cap = await get_cap(settings, remaining_seconds, files, query, total_results, search)
try:
await query.message.edit_text(text=cap, reply_markup=InlineKeyboardMarkup(btn), disable_web_page_preview=True)
except MessageNotModified:
pass
else:
try:
await query.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(btn))
except MessageNotModified:
pass
await query.answer()
@Client.on_callback_query()
async def cb_handler(client: Client, query: CallbackQuery):
lazyData = query.data
try:
link = await client.create_chat_invite_link(int(REQST_CHANNEL))
except:
pass
if query.data == "close_data":
await query.message.delete()
elif query.data == "gfiltersdeleteallconfirm":
await del_allg(query.message, 'gfilters')
await query.answer("ᴅᴏɴᴇ !")
return
elif query.data == "gfiltersdeleteallcancel":
await query.message.reply_to_message.delete()
await query.message.delete()
await query.answer("ᴘʀᴏᴄᴇꜱꜱ ᴄᴀɴᴄᴇʟʟᴇᴅ !")
return
elif query.data == "delallconfirm":
userid = query.from_user.id
chat_type = query.message.chat.type
if chat_type == enums.ChatType.PRIVATE:
grpid = await active_connection(str(userid))
if grpid is not None:
grp_id = grpid
try:
chat = await client.get_chat(grpid)
title = chat.title
except:
await query.message.edit_text("Mᴀᴋᴇ sᴜʀᴇ I'ᴍ ᴘʀᴇsᴇɴᴛ ɪɴ ʏᴏᴜʀ ɢʀᴏᴜᴘ!!", quote=True)
return await query.answer(MSG_ALRT)
else:
await query.message.edit_text(
"I'ᴍ ɴᴏᴛ ᴄᴏɴɴᴇᴄᴛᴇᴅ ᴛᴏ ᴀɴʏ ɢʀᴏᴜᴘs !\nCʜᴇᴄᴋ /connections ᴏʀ ᴄᴏɴɴᴇᴄᴛ ᴛᴏ ᴀɴʏ ɢʀᴏᴜᴘs.",
quote=True
)
return await query.answer(MSG_ALRT)
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
grp_id = query.message.chat.id
title = query.message.chat.title
else:
return await query.answer(MSG_ALRT)
st = await client.get_chat_member(grp_id, userid)
if (st.status == enums.ChatMemberStatus.OWNER) or (str(userid) in ADMINS):
await del_all(query.message, grp_id, title)
else:
await query.answer("Yᴏᴜ ɴᴇᴇᴅ ᴛᴏ ʙᴇ Gʀᴏᴜᴘ Oᴡɴᴇʀ ᴏʀ ᴀɴ Aᴜᴛʜ Usᴇʀ ᴛᴏ ᴅᴏ ᴛʜᴀᴛ !", show_alert=True)
elif query.data == "delallcancel":
userid = query.from_user.id
chat_type = query.message.chat.type
if chat_type == enums.ChatType.PRIVATE:
await query.message.reply_to_message.delete()
await query.message.delete()
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
grp_id = query.message.chat.id
st = await client.get_chat_member(grp_id, userid)
if (st.status == enums.ChatMemberStatus.OWNER) or (str(userid) in ADMINS):
await query.message.delete()
try:
await query.message.reply_to_message.delete()
except:
pass
else:
await query.answer("Tʜᴀᴛ's ɴᴏᴛ ғᴏʀ ʏᴏᴜ!!", show_alert=True)
elif "groupcb" in query.data:
await query.answer()
group_id = query.data.split(":")[1]
act = query.data.split(":")[2]
hr = await client.get_chat(int(group_id))
title = hr.title
user_id = query.from_user.id
if act == "":
stat = "ᴄᴏɴɴᴇᴄᴛ"
cb = "connectcb"
else:
stat = "ᴅɪꜱᴄᴏɴɴᴇᴄᴛ"
cb = "disconnect"
keyboard = InlineKeyboardMarkup([
[InlineKeyboardButton(f"{stat}", callback_data=f"{cb}:{group_id}"),
InlineKeyboardButton("ᴅᴇʟᴇᴛᴇ", callback_data=f"deletecb:{group_id}")],
[InlineKeyboardButton("ʙᴀᴄᴋ", callback_data="backcb")]
])
await query.message.edit_text(
f"Gʀᴏᴜᴘ Nᴀᴍᴇ : **{title}**\nGʀᴏᴜᴘ ID : `{group_id}`",
reply_markup=keyboard,
parse_mode=enums.ParseMode.MARKDOWN
)
return await query.answer(MSG_ALRT)
elif "connectcb" in query.data:
await query.answer()
group_id = query.data.split(":")[1]
hr = await client.get_chat(int(group_id))
title = hr.title
user_id = query.from_user.id
mkact = await make_active(str(user_id), str(group_id))
if mkact:
await query.message.edit_text(
f"Cᴏɴɴᴇᴄᴛᴇᴅ ᴛᴏ **{title}**",
parse_mode=enums.ParseMode.MARKDOWN
)
else:
await query.message.edit_text('Sᴏᴍᴇ ᴇʀʀᴏʀ ᴏᴄᴄᴜʀʀᴇᴅ!!', parse_mode=enums.ParseMode.MARKDOWN)
return await query.answer(MSG_ALRT)
elif "disconnect" in query.data:
await query.answer()
group_id = query.data.split(":")[1]
hr = await client.get_chat(int(group_id))
title = hr.title
user_id = query.from_user.id
mkinact = await make_inactive(str(user_id))
if mkinact:
await query.message.edit_text(
f"Dɪsᴄᴏɴɴᴇᴄᴛᴇᴅ ғʀᴏᴍ **{title}**",
parse_mode=enums.ParseMode.MARKDOWN
)
else:
await query.message.edit_text(
f"Sᴏᴍᴇ ᴇʀʀᴏʀ ᴏᴄᴄᴜʀʀᴇᴅ!!",
parse_mode=enums.ParseMode.MARKDOWN
)
return await query.answer(MSG_ALRT)
elif "deletecb" in query.data:
await query.answer()
user_id = query.from_user.id
group_id = query.data.split(":")[1]
delcon = await delete_connection(str(user_id), str(group_id))
if delcon:
await query.message.edit_text(
"Sᴜᴄᴄᴇssғᴜʟʟʏ ᴅᴇʟᴇᴛᴇᴅ ᴄᴏɴɴᴇᴄᴛɪᴏɴ !"
)
else:
await query.message.edit_text(
f"Sᴏᴍᴇ ᴇʀʀᴏʀ ᴏᴄᴄᴜʀʀᴇᴅ!!",
parse_mode=enums.ParseMode.MARKDOWN
)
return await query.answer(MSG_ALRT)
elif query.data == "backcb":
await query.answer()
userid = query.from_user.id
groupids = await all_connections(str(userid))
if groupids is None:
await query.message.edit_text(
"Tʜᴇʀᴇ ᴀʀᴇ ɴᴏ ᴀᴄᴛɪᴠᴇ ᴄᴏɴɴᴇᴄᴛɪᴏɴs!! Cᴏɴɴᴇᴄᴛ ᴛᴏ sᴏᴍᴇ ɢʀᴏᴜᴘs ғɪʀsᴛ.",
)
return await query.answer(MSG_ALRT)
buttons = []
for groupid in groupids:
try:
ttl = await client.get_chat(int(groupid))
title = ttl.title
active = await if_active(str(userid), str(groupid))
act = " - ACTIVE" if active else ""
buttons.append(
[
InlineKeyboardButton(
text=f"{title}{act}", callback_data=f"groupcb:{groupid}:{act}"
)
]
)
except:
pass
if buttons:
await query.message.edit_text(
"Yᴏᴜʀ ᴄᴏɴɴᴇᴄᴛᴇᴅ ɢʀᴏᴜᴘ ᴅᴇᴛᴀɪʟs ;\n\n",
reply_markup=InlineKeyboardMarkup(buttons)
)
elif "gfilteralert" in query.data:
grp_id = query.message.chat.id
i = query.data.split(":")[1]
keyword = query.data.split(":")[2]
reply_text, btn, alerts, fileid = await find_gfilter('gfilters', keyword)
if alerts is not None:
alerts = ast.literal_eval(alerts)
alert = alerts[int(i)]
alert = alert.replace("\\n", "\n").replace("\\t", "\t")
await query.answer(alert, show_alert=True)
elif "alertmessage" in query.data:
grp_id = query.message.chat.id
i = query.data.split(":")[1]
keyword = query.data.split(":")[2]
reply_text, btn, alerts, fileid = await find_filter(grp_id, keyword)
if alerts is not None:
alerts = ast.literal_eval(alerts)
alert = alerts[int(i)]
alert = alert.replace("\\n", "\n").replace("\\t", "\t")
await query.answer(alert, show_alert=True)
if query.data.startswith("file"):
clicked = query.from_user.id
try:
typed = query.from_user.id
except:
typed = query.from_user.id
ident, file_id = query.data.split("#")
files_ = await get_file_details(file_id)
if not files_:
return await query.answer('Nᴏ sᴜᴄʜ ғɪʟᴇ ᴇxɪsᴛ.')
files = files_[0]
title = files.file_name
size = get_size(files.file_size)
f_caption = files.caption
settings = await get_settings(query.message.chat.id)
if CUSTOM_FILE_CAPTION:
try:
f_caption = CUSTOM_FILE_CAPTION.format(file_name='' if title is None else title,
file_size='' if size is None else size,
file_caption='' if f_caption is None else f_caption)
except Exception as e:
logger.exception(e)
f_caption = f_caption
if f_caption is None:
f_caption = f"{files.file_name}"
try:
if not await db.has_premium_access(clicked) and settings['is_shortlink']: #Don't change Anything without my permission @CodeluffyTG
if clicked == query.from_user.id:
temp.SHORT[clicked] = query.message.chat.id
await query.answer(url=f"https://telegram.me/{temp.U_NAME}?start=short_{file_id}")
return
else:
await query.answer(f"Hᴇʏ {query.from_user.first_name},\nTʜɪs Is Nᴏᴛ Yᴏᴜʀ Mᴏᴠɪᴇ Rᴇǫᴜᴇsᴛ.\nRᴇǫᴜᴇsᴛ Yᴏᴜʀ's !", show_alert=True)
else:
if clicked == query.from_user.id:
await query.answer(url=f"https://telegram.me/{temp.U_NAME}?start={ident}_{file_id}")
return
else:
await query.answer(f"Hᴇʏ {query.from_user.first_name},\nTʜɪs Is Nᴏᴛ Yᴏᴜʀ Mᴏᴠɪᴇ Rᴇǫᴜᴇsᴛ.\nRᴇǫᴜᴇsᴛ Yᴏᴜʀ's !", show_alert=True)
except UserIsBlocked:
await query.answer('Uɴʙʟᴏᴄᴋ ᴛʜᴇ ʙᴏᴛ ᴍᴀʜɴ !', show_alert=True)
except PeerIdInvalid:
await query.answer(url=f"https://telegram.me/{temp.U_NAME}?start={ident}_{file_id}")
except Exception as e:
await query.answer(url=f"https://telegram.me/{temp.U_NAME}?start={ident}_{file_id}")
elif query.data.startswith("sendfiles"):
clicked = query.from_user.id
ident, key = query.data.split("#")
settings = await get_settings(query.message.chat.id)
try:
if not await db.has_premium_access(clicked) and settings['is_shortlink']: # Don't Change anything without my permission @CoderluffyTG
await query.answer(url=f"https://telegram.me/{temp.U_NAME}?start=sendfiles1_{key}")
return
else:
await query.answer(url=f"https://telegram.me/{temp.U_NAME}?start=allfiles_{key}")
return
except UserIsBlocked:
await query.answer('Uɴʙʟᴏᴄᴋ ᴛʜᴇ ʙᴏᴛ ᴍᴀʜɴ !', show_alert=True)
except PeerIdInvalid:
await query.answer(url=f"https://telegram.me/{temp.U_NAME}?start=sendfiles3_{key}")
except Exception as e:
logger.exception(e)
await query.answer(url=f"https://telegram.me/{temp.U_NAME}?start=sendfiles4_{key}")
elif query.data.startswith("del"):
ident, file_id = query.data.split("#")
files_ = await get_file_details(file_id)
if not files_:
return await query.answer('Nᴏ sᴜᴄʜ ғɪʟᴇ ᴇxɪsᴛ.')
files = files_[0]
title = files.file_name
size = get_size(files.file_size)
f_caption = files.caption
settings = await get_settings(query.message.chat.id)
if CUSTOM_FILE_CAPTION:
try:
f_caption = CUSTOM_FILE_CAPTION.format(file_name='' if title is None else title,
file_size='' if size is None else size,
file_caption='' if f_caption is None else f_caption)
except Exception as e:
logger.exception(e)
f_caption = f_caption
if f_caption is None:
f_caption = f"{files.file_name}"
await query.answer(url=f"https://telegram.me/{temp.U_NAME}?start=file_{file_id}")
elif query.data.startswith("checksub"):
if AUTH_CHANNEL and not await is_req_subscribed(client, query):
await query.answer("Jᴏɪɴ ᴏᴜʀ ᴜᴘᴅᴀᴛᴇꜱ ᴄʜᴀɴɴᴇʟ ᴍᴀʜɴ! 😒", show_alert=True)
return
ident, kk, file_id = query.data.split("#")
await query.answer(url=f"https://t.me/{temp.U_NAME}?start={kk}_{file_id}")
elif query.data == "pages":
await query.answer()
elif query.data.startswith("send_fsall"):
temp_var, ident, key, offset = query.data.split("#")
search = BUTTON0.get(key)
if not search:
await query.answer(script.OLD_ALRT_TXT.format(query.from_user.first_name),show_alert=True)
return
files, n_offset, total = await get_search_results(query.message.chat.id, search, offset=int(offset), filter=True)
await send_all(client, query.from_user.id, files, ident, query.message.chat.id, query.from_user.first_name, query)
search = BUTTONS1.get(key)
files, n_offset, total = await get_search_results(query.message.chat.id, search, offset=int(offset), filter=True)
await send_all(client, query.from_user.id, files, ident, query.message.chat.id, query.from_user.first_name, query)
search = BUTTONS2.get(key)
files, n_offset, total = await get_search_results(query.message.chat.id, search, offset=int(offset), filter=True)
await send_all(client, query.from_user.id, files, ident, query.message.chat.id, query.from_user.first_name, query)
await query.answer(f"ʜᴇʏ {query.from_user.first_name}, ᴀʟʟ ꜰɪʟᴇꜱ ᴏɴ ᴛʜɪꜱ ᴘᴀɢᴇ ʜᴀꜱ ʙᴇᴇɴ ꜱᴇɴᴛ ꜱᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ ᴛᴏ ʏᴏᴜ ʙʏ ᴅᴍ !", show_alert=True)
elif query.data.startswith("send_fall"):
temp_var, ident, key, offset = query.data.split("#")
if BUTTONS.get(key)!=None:
search = BUTTONS.get(key)
else:
search = FRESH.get(key)
if not search:
await query.answer(script.OLD_ALRT_TXT.format(query.from_user.first_name),show_alert=True)
return
files, n_offset, total = await get_search_results(query.message.chat.id, search, offset=int(offset), filter=True)
await send_all(client, query.from_user.id, files, ident, query.message.chat.id, query.from_user.first_name, query)
await query.answer(f"ʜᴇʏ {query.from_user.first_name}, ᴀʟʟ ꜰɪʟᴇꜱ ᴏɴ ᴛʜɪꜱ ᴘᴀɢᴇ ʜᴀꜱ ʙᴇᴇɴ ꜱᴇɴᴛ ꜱᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ ᴛᴏ ʏᴏᴜ ʙʏ ᴅᴍ !", show_alert=True)
elif query.data.startswith("killfilesdq"):
ident, keyword = query.data.split("#")
#await query.message.edit_text(f"<b>Fetching Files for your query {keyword} on DB... Please wait...</b>")
files, total = await get_bad_files(keyword)
await query.message.edit_text("<b>ꜰɪʟᴇ ᴅᴇʟᴇᴛɪᴏɴ ᴘʀᴏᴄᴇꜱꜱ ᴡɪʟʟ ꜱᴛᴀʀᴛ ɪɴ 5 ꜱᴇᴄᴏɴᴅꜱ !</b>")
await asyncio.sleep(5)
deleted = 0
async with lock:
try:
for file in files:
file_ids = file.file_id
file_name = file.file_name
result = await Media.collection.delete_one({
'_id': file_ids,
})
if result.deleted_count:
logger.info(f'ꜰɪʟᴇ ꜰᴏᴜɴᴅ ꜰᴏʀ ʏᴏᴜʀ ǫᴜᴇʀʏ {keyword}! ꜱᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ ᴅᴇʟᴇᴛᴇᴅ {file_name} ꜰʀᴏᴍ ᴅᴀᴛᴀʙᴀꜱᴇ.')
deleted += 1
if deleted % 20 == 0:
await query.message.edit_text(f"<b>ᴘʀᴏᴄᴇꜱꜱ ꜱᴛᴀʀᴛᴇᴅ ꜰᴏʀ ᴅᴇʟᴇᴛɪɴɢ ꜰɪʟᴇꜱ ꜰʀᴏᴍ ᴅʙ. ꜱᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ ᴅᴇʟᴇᴛᴇᴅ {str(deleted)} ꜰɪʟᴇꜱ ꜰʀᴏᴍ ᴅʙ ꜰᴏʀ ʏᴏᴜʀ ǫᴜᴇʀʏ {keyword} !\n\nᴘʟᴇᴀꜱᴇ ᴡᴀɪᴛ...</b>")
except Exception as e:
logger.exception(e)
await query.message.edit_text(f'Error: {e}')
else:
await query.message.edit_text(f"<b>ᴘʀᴏᴄᴇꜱꜱ ᴄᴏᴍᴘʟᴇᴛᴇᴅ ꜰᴏʀ ꜰɪʟᴇ ᴅᴇʟᴇᴛᴀᴛɪᴏɴ !\n\nꜱᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ ᴅᴇʟᴇᴛᴇᴅ {str(deleted)} ꜰɪʟᴇꜱ ꜰʀᴏᴍ ᴅʙ ꜰᴏʀ ʏᴏᴜʀ ǫᴜᴇʀʏ {keyword}.</b>")
elif query.data.startswith("opnsetgrp"):
ident, grp_id = query.data.split("#")
userid = query.from_user.id if query.from_user else None
st = await client.get_chat_member(grp_id, userid)
if (
st.status != enums.ChatMemberStatus.ADMINISTRATOR
and st.status != enums.ChatMemberStatus.OWNER
and str(userid) not in ADMINS
):
await query.answer("ʏᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ ʀɪɢʜᴛꜱ ᴛᴏ ᴅᴏ ᴛʜɪꜱ !", show_alert=True)
return
title = query.message.chat.title
settings = await get_settings(grp_id)
if settings is not None:
buttons = [
[
InlineKeyboardButton('ʀᴇꜱᴜʟᴛ ᴘᴀɢᴇ',
callback_data=f'setgs#button#{settings["button"]}#{str(grp_id)}'),
InlineKeyboardButton('ʙᴜᴛᴛᴏɴ' if settings["button"] else 'ᴛᴇxᴛ',
callback_data=f'setgs#button#{settings["button"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ꜰɪʟᴇ ꜱᴇɴᴅ ᴍᴏᴅᴇ', callback_data=f'setgs#botpm#{settings["botpm"]}#{str(grp_id)}'),
InlineKeyboardButton('ꜱᴛᴀʀᴛ' if settings["botpm"] else 'ᴀᴜᴛᴏ',
callback_data=f'setgs#botpm#{settings["botpm"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ꜰɪʟᴇ ꜱᴇᴄᴜʀᴇ',
callback_data=f'setgs#file_secure#{settings["file_secure"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["file_secure"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#file_secure#{settings["file_secure"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ɪᴍᴅʙ ᴘᴏꜱᴛᴇʀ', callback_data=f'setgs#imdb#{settings["imdb"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["imdb"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#imdb#{settings["imdb"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ꜱᴘᴇʟʟ ᴄʜᴇᴄᴋ',
callback_data=f'setgs#spell_check#{settings["spell_check"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["spell_check"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#spell_check#{settings["spell_check"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ᴡᴇʟᴄᴏᴍᴇ ᴍꜱɢ', callback_data=f'setgs#welcome#{settings["welcome"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["welcome"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#welcome#{settings["welcome"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ᴀᴜᴛᴏ ᴅᴇʟᴇᴛᴇ',
callback_data=f'setgs#auto_delete#{settings["auto_delete"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["auto_delete"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#auto_delete#{settings["auto_delete"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ᴀᴜᴛᴏ ꜰɪʟᴛᴇʀ',
callback_data=f'setgs#auto_ffilter#{settings["auto_ffilter"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["auto_ffilter"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#auto_ffilter#{settings["auto_ffilter"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ᴍᴀx ʙᴜᴛᴛᴏɴꜱ',
callback_data=f'setgs#max_btn#{settings["max_btn"]}#{str(grp_id)}'),
InlineKeyboardButton('10' if settings["max_btn"] else f'{MAX_B_TN}',
callback_data=f'setgs#max_btn#{settings["max_btn"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ꜱʜᴏʀᴛʟɪɴᴋ',
callback_data=f'setgs#is_shortlink#{settings["is_shortlink"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["is_shortlink"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#is_shortlink#{settings["is_shortlink"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('⇋ ᴄʟᴏꜱᴇ ꜱᴇᴛᴛɪɴɢꜱ ᴍᴇɴᴜ ⇋',
callback_data='close_data'
)
]
]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=f"<b>ᴄʜᴀɴɢᴇ ʏᴏᴜʀ ꜱᴇᴛᴛɪɴɢꜱ ꜰᴏʀ {title} ᴀꜱ ʏᴏᴜ ᴡɪꜱʜ ⚙</b>",
disable_web_page_preview=True,
parse_mode=enums.ParseMode.HTML
)
await query.message.edit_reply_markup(reply_markup)
elif query.data.startswith("opnsetpm"):
ident, grp_id = query.data.split("#")
userid = query.from_user.id if query.from_user else None
st = await client.get_chat_member(grp_id, userid)
if (
st.status != enums.ChatMemberStatus.ADMINISTRATOR
and st.status != enums.ChatMemberStatus.OWNER
and str(userid) not in ADMINS
):
await query.answer("Yᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ sᴜғғɪᴄɪᴀɴᴛ ʀɪɢʜᴛs ᴛᴏ ᴅᴏ ᴛʜɪs !", show_alert=True)
return
title = query.message.chat.title
settings = await get_settings(grp_id)
btn2 = [[
InlineKeyboardButton("ᴄʜᴇᴄᴋ ᴍʏ ᴅᴍ 🗳️", url=f"telegram.me/{temp.U_NAME}")
]]
reply_markup = InlineKeyboardMarkup(btn2)
await query.message.edit_text(f"<b>ʏᴏᴜʀ sᴇᴛᴛɪɴɢs ᴍᴇɴᴜ ғᴏʀ {title} ʜᴀs ʙᴇᴇɴ sᴇɴᴛ ᴛᴏ ʏᴏᴜ ʙʏ ᴅᴍ.</b>")
await query.message.edit_reply_markup(reply_markup)
if settings is not None:
buttons = [
[
InlineKeyboardButton('ʀᴇꜱᴜʟᴛ ᴘᴀɢᴇ',
callback_data=f'setgs#button#{settings["button"]}#{str(grp_id)}'),
InlineKeyboardButton('ʙᴜᴛᴛᴏɴ' if settings["button"] else 'ᴛᴇxᴛ',
callback_data=f'setgs#button#{settings["button"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ꜰɪʟᴇ ꜱᴇɴᴅ ᴍᴏᴅᴇ', callback_data=f'setgs#botpm#{settings["botpm"]}#{str(grp_id)}'),
InlineKeyboardButton('ꜱᴛᴀʀᴛ' if settings["botpm"] else 'ᴀᴜᴛᴏ',
callback_data=f'setgs#botpm#{settings["botpm"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ꜰɪʟᴇ ꜱᴇᴄᴜʀᴇ',
callback_data=f'setgs#file_secure#{settings["file_secure"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["file_secure"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#file_secure#{settings["file_secure"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ɪᴍᴅʙ ᴘᴏꜱᴛᴇʀ', callback_data=f'setgs#imdb#{settings["imdb"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["imdb"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#imdb#{settings["imdb"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ꜱᴘᴇʟʟ ᴄʜᴇᴄᴋ',
callback_data=f'setgs#spell_check#{settings["spell_check"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["spell_check"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#spell_check#{settings["spell_check"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ᴡᴇʟᴄᴏᴍᴇ ᴍꜱɢ', callback_data=f'setgs#welcome#{settings["welcome"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["welcome"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#welcome#{settings["welcome"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ᴀᴜᴛᴏ ᴅᴇʟᴇᴛᴇ',
callback_data=f'setgs#auto_delete#{settings["auto_delete"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["auto_delete"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#auto_delete#{settings["auto_delete"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ᴀᴜᴛᴏ ꜰɪʟᴛᴇʀ',
callback_data=f'setgs#auto_ffilter#{settings["auto_ffilter"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["auto_ffilter"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#auto_ffilter#{settings["auto_ffilter"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ᴍᴀx ʙᴜᴛᴛᴏɴꜱ',
callback_data=f'setgs#max_btn#{settings["max_btn"]}#{str(grp_id)}'),
InlineKeyboardButton('10' if settings["max_btn"] else f'{MAX_B_TN}',
callback_data=f'setgs#max_btn#{settings["max_btn"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ꜱʜᴏʀᴛʟɪɴᴋ',
callback_data=f'setgs#is_shortlink#{settings["is_shortlink"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["is_shortlink"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#is_shortlink#{settings["is_shortlink"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('⇋ ᴄʟᴏꜱᴇ ꜱᴇᴛᴛɪɴɢꜱ ᴍᴇɴᴜ ⇋',
callback_data='close_data'
)
]
]
reply_markup = InlineKeyboardMarkup(buttons)
await client.send_message(
chat_id=userid,
text=f"<b>ᴄʜᴀɴɢᴇ ʏᴏᴜʀ ꜱᴇᴛᴛɪɴɢꜱ ꜰᴏʀ {title} ᴀꜱ ʏᴏᴜ ᴡɪꜱʜ ⚙</b>",
reply_markup=reply_markup,
disable_web_page_preview=True,
parse_mode=enums.ParseMode.HTML,
reply_to_message_id=query.message.id
)
elif query.data.startswith("show_option"):
ident, from_user = query.data.split("#")
btn = [[
InlineKeyboardButton("⚠️ ᴜɴᴀᴠᴀɪʟᴀʙʟᴇ ⚠️", callback_data=f"unavailable#{from_user}"),
InlineKeyboardButton("🟢 ᴜᴘʟᴏᴀᴅᴇᴅ 🟢", callback_data=f"uploaded#{from_user}")
],[
InlineKeyboardButton("♻️ ᴀʟʀᴇᴀᴅʏ ᴀᴠᴀɪʟᴀʙʟᴇ ♻️", callback_data=f"already_available#{from_user}")
]]
btn2 = [[
InlineKeyboardButton("ᴠɪᴇᴡ ꜱᴛᴀᴛᴜꜱ", url=f"{query.message.link}")
]]
if query.from_user.id in ADMINS:
user = await client.get_users(from_user)
reply_markup = InlineKeyboardMarkup(btn)
await query.message.edit_reply_markup(reply_markup)
await query.answer("Hᴇʀᴇ ᴀʀᴇ ᴛʜᴇ ᴏᴘᴛɪᴏɴs !")
else:
await query.answer("Yᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ sᴜғғɪᴄɪᴀɴᴛ ʀɪɢʜᴛs ᴛᴏ ᴅᴏ ᴛʜɪs !", show_alert=True)
elif query.data.startswith("unavailable"):
ident, from_user = query.data.split("#")
btn = [[
InlineKeyboardButton("⚠️ ᴜɴᴀᴠᴀɪʟᴀʙʟᴇ ⚠️", callback_data=f"unalert#{from_user}")
]]
btn2 = [[
InlineKeyboardButton('ᴊᴏɪɴ ᴄʜᴀɴɴᴇʟ', url=link.invite_link),
InlineKeyboardButton("ᴠɪᴇᴡ ꜱᴛᴀᴛᴜꜱ", url=f"{query.message.link}")
]]
if query.from_user.id in ADMINS:
user = await client.get_users(from_user)
reply_markup = InlineKeyboardMarkup(btn)
content = query.message.text
await query.message.edit_text(f"<b><strike>{content}</strike></b>")
await query.message.edit_reply_markup(reply_markup)
await query.answer("Sᴇᴛ ᴛᴏ Uɴᴀᴠᴀɪʟᴀʙʟᴇ !")
try:
await client.send_message(chat_id=int(from_user), text=f"<b>Hᴇʏ {user.mention}, Sᴏʀʀʏ Yᴏᴜʀ ʀᴇᴏ̨ᴜᴇsᴛ ɪs ᴜɴᴀᴠᴀɪʟᴀʙʟᴇ. Sᴏ ᴏᴜʀ ᴍᴏᴅᴇʀᴀᴛᴏʀs ᴄᴀɴ'ᴛ ᴜᴘʟᴏᴀᴅ ɪᴛ.</b>", reply_markup=InlineKeyboardMarkup(btn2))
except UserIsBlocked:
await client.send_message(chat_id=int(SUPPORT_CHAT_ID), text=f"<b>Hᴇʏ {user.mention}, Sᴏʀʀʏ Yᴏᴜʀ ʀᴇᴏ̨ᴜᴇsᴛ ɪs ᴜɴᴀᴠᴀɪʟᴀʙʟᴇ. Sᴏ ᴏᴜʀ ᴍᴏᴅᴇʀᴀᴛᴏʀs ᴄᴀɴ'ᴛ ᴜᴘʟᴏᴀᴅ ɪᴛ.\n\nNᴏᴛᴇ: Tʜɪs ᴍᴇssᴀɢᴇ ɪs sᴇɴᴛ ᴛᴏ ᴛʜɪs ɢʀᴏᴜᴘ ʙᴇᴄᴀᴜsᴇ ʏᴏᴜ'ᴠᴇ ʙʟᴏᴄᴋᴇᴅ ᴛʜᴇ ʙᴏᴛ. Tᴏ sᴇɴᴅ ᴛʜɪs ᴍᴇssᴀɢᴇ ᴛᴏ ʏᴏᴜʀ PM, Mᴜsᴛ ᴜɴʙʟᴏᴄᴋ ᴛʜᴇ ʙᴏᴛ.</b>", reply_markup=InlineKeyboardMarkup(btn2))
else:
await query.answer("Yᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ sᴜғғɪᴄɪᴀɴᴛ ʀɪɢʜᴛs ᴛᴏ ᴅᴏ ᴛʜɪs !", show_alert=True)
elif query.data.startswith("uploaded"):
ident, from_user = query.data.split("#")
btn = [[
InlineKeyboardButton("🟢 ᴜᴘʟᴏᴀᴅᴇᴅ 🟢", callback_data=f"upalert#{from_user}")
]]
btn2 = [[
InlineKeyboardButton('ᴊᴏɪɴ ᴄʜᴀɴɴᴇʟ', url=link.invite_link),
InlineKeyboardButton("ᴠɪᴇᴡ ꜱᴛᴀᴛᴜꜱ", url=f"{query.message.link}")
],[
InlineKeyboardButton("🔍 ꜱᴇᴀʀᴄʜ ʜᴇʀᴇ 🔎", url="https://t.me/MoviesLinkSearchBot2")
]]
if query.from_user.id in ADMINS:
user = await client.get_users(from_user)
reply_markup = InlineKeyboardMarkup(btn)
content = query.message.text
await query.message.edit_text(f"<b><strike>{content}</strike></b>")
await query.message.edit_reply_markup(reply_markup)
await query.answer("Sᴇᴛ ᴛᴏ Uᴘʟᴏᴀᴅᴇᴅ !")
try:
await client.send_message(chat_id=int(from_user), text=f"<b>Hᴇʏ {user.mention}, Yᴏᴜʀ ʀᴇᴏ̨ᴜᴇsᴛ ʜᴀs ʙᴇᴇɴ ᴜᴘʟᴏᴀᴅᴇᴅ ʙʏ ᴏᴜʀ ᴍᴏᴅᴇʀᴀᴛᴏʀs. Kɪɴᴅʟʏ sᴇᴀʀᴄʜ ɪɴ ᴏᴜʀ Gʀᴏᴜᴘ.</b>", reply_markup=InlineKeyboardMarkup(btn2))
except UserIsBlocked:
await client.send_message(chat_id=int(SUPPORT_CHAT_ID), text=f"<b>Hᴇʏ {user.mention}, Yᴏᴜʀ ʀᴇᴏ̨ᴜᴇsᴛ ʜᴀs ʙᴇᴇɴ ᴜᴘʟᴏᴀᴅᴇᴅ ʙʏ ᴏᴜʀ ᴍᴏᴅᴇʀᴀᴛᴏʀs. Kɪɴᴅʟʏ sᴇᴀʀᴄʜ ɪɴ ᴏᴜʀ Gʀᴏᴜᴘ.\n\nNᴏᴛᴇ: Tʜɪs ᴍᴇssᴀɢᴇ ɪs sᴇɴᴛ ᴛᴏ ᴛʜɪs ɢʀᴏᴜᴘ ʙᴇᴄᴀᴜsᴇ ʏᴏᴜ'ᴠᴇ ʙʟᴏᴄᴋᴇᴅ ᴛʜᴇ ʙᴏᴛ. Tᴏ sᴇɴᴅ ᴛʜɪs ᴍᴇssᴀɢᴇ ᴛᴏ ʏᴏᴜʀ PM, Mᴜsᴛ ᴜɴʙʟᴏᴄᴋ ᴛʜᴇ ʙᴏᴛ.</b>", reply_markup=InlineKeyboardMarkup(btn2))
else:
await query.answer("Yᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ sᴜғғɪᴄɪᴀɴᴛ ʀɪɢᴛs ᴛᴏ ᴅᴏ ᴛʜɪs !", show_alert=True)
elif query.data.startswith("already_available"):
ident, from_user = query.data.split("#")
btn = [[
InlineKeyboardButton("♻️ ᴀʟʀᴇᴀᴅʏ ᴀᴠᴀɪʟᴀʙʟᴇ ♻️", callback_data=f"alalert#{from_user}")
]]
btn2 = [[
InlineKeyboardButton('ᴊᴏɪɴ ᴄʜᴀɴɴᴇʟ', url=link.invite_link),
InlineKeyboardButton("ᴠɪᴇᴡ ꜱᴛᴀᴛᴜꜱ", url=f"{query.message.link}")
],[
InlineKeyboardButton("🔍 ꜱᴇᴀʀᴄʜ ʜᴇʀᴇ 🔎", url="https://t.me/MoviesLinkSearchBot2")
]]
if query.from_user.id in ADMINS:
user = await client.get_users(from_user)
reply_markup = InlineKeyboardMarkup(btn)
content = query.message.text
await query.message.edit_text(f"<b><strike>{content}</strike></b>")
await query.message.edit_reply_markup(reply_markup)
await query.answer("Sᴇᴛ ᴛᴏ Aʟʀᴇᴀᴅʏ Aᴠᴀɪʟᴀʙʟᴇ !")
try:
await client.send_message(chat_id=int(from_user), text=f"<b>Hᴇʏ {user.mention}, Yᴏᴜʀ ʀᴇᴏ̨ᴜᴇsᴛ ɪs ᴀʟʀᴇᴀᴅʏ ᴀᴠᴀɪʟᴀʙʟᴇ ᴏɴ ᴏᴜʀ ʙᴏᴛ's ᴅᴀᴛᴀʙᴀsᴇ. Kɪɴᴅʟʏ sᴇᴀʀᴄʜ ɪɴ ᴏᴜʀ Gʀᴏᴜᴘ.</b>", reply_markup=InlineKeyboardMarkup(btn2))
except UserIsBlocked:
await client.send_message(chat_id=int(SUPPORT_CHAT_ID), text=f"<b>Hᴇʏ {user.mention}, Yᴏᴜʀ ʀᴇᴏ̨ᴜᴇsᴛ ɪs ᴀʟʀᴇᴀᴅʏ ᴀᴠᴀɪʟᴀʙʟᴇ ᴏɴ ᴏᴜʀ ʙᴏᴛ's ᴅᴀᴛᴀʙᴀsᴇ. Kɪɴᴅʟʏ sᴇᴀʀᴄʜ ɪɴ ᴏᴜʀ Gʀᴏᴜᴘ.\n\nNᴏᴛᴇ: Tʜɪs ᴍᴇssᴀɢᴇ ɪs sᴇɴᴛ ᴛᴏ ᴛʜɪs ɢʀᴏᴜᴘ ʙᴇᴄᴀᴜsᴇ ʏᴏᴜ'ᴠᴇ ʙʟᴏᴄᴋᴇᴅ ᴛʜᴇ ʙᴏᴛ. Tᴏ sᴇɴᴅ ᴛʜɪs ᴍᴇssᴀɢᴇ ᴛᴏ ʏᴏᴜʀ PM, Mᴜsᴛ ᴜɴʙʟᴏᴄᴋ ᴛʜᴇ ʙᴏᴛ.</b>", reply_markup=InlineKeyboardMarkup(btn2))
else:
await query.answer("Yᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ sᴜғғɪᴄɪᴀɴᴛ ʀɪɢᴛs ᴛᴏ ᴅᴏ ᴛʜɪs !", show_alert=True)
elif query.data.startswith("alalert"):
ident, from_user = query.data.split("#")
if int(query.from_user.id) == int(from_user):
user = await client.get_users(from_user)
await query.answer(f"Hᴇʏ {user.first_name}, Yᴏᴜʀ Rᴇᴏ̨ᴜᴇsᴛ ɪs Aʟʀᴇᴀᴅʏ Aᴠᴀɪʟᴀʙʟᴇ !", show_alert=True)
else:
await query.answer("Yᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ sᴜғғɪᴄɪᴀɴᴛ ʀɪɢᴛs ᴛᴏ ᴅᴏ ᴛʜɪs !", show_alert=True)
elif query.data.startswith("upalert"):
ident, from_user = query.data.split("#")
if int(query.from_user.id) == int(from_user):
user = await client.get_users(from_user)
await query.answer(f"Hᴇʏ {user.first_name}, Yᴏᴜʀ Rᴇᴏ̨ᴜᴇsᴛ ɪs Uᴘʟᴏᴀᴅᴇᴅ !", show_alert=True)
else:
await query.answer("Yᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ sᴜғғɪᴄɪᴀɴᴛ ʀɪɢᴛs ᴛᴏ ᴅᴏ ᴛʜɪs !", show_alert=True)
elif query.data.startswith("unalert"):
ident, from_user = query.data.split("#")
if int(query.from_user.id) == int(from_user):
user = await client.get_users(from_user)
await query.answer(f"Hᴇʏ {user.first_name}, Yᴏᴜʀ Rᴇᴏ̨ᴜᴇsᴛ ɪs Uɴᴀᴠᴀɪʟᴀʙʟᴇ !", show_alert=True)
else:
await query.answer("Yᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ sᴜғғɪᴄɪᴀɴᴛ ʀɪɢᴛs ᴛᴏ ᴅᴏ ᴛʜɪs !", show_alert=True)
elif lazyData.startswith("generate_stream_link"):
_, file_id = lazyData.split(":")
try:
user_id = query.from_user.id
username = query.from_user.mention
log_msg = await client.send_cached_media(
chat_id=LOG_CHANNEL,
file_id=file_id,
)
fileName = {quote_plus(get_name(log_msg))}
lazy_stream = f"{URL}watch/{str(log_msg.id)}/{quote_plus(get_name(log_msg))}?hash={get_hash(log_msg)}"
lazy_download = f"{URL}{str(log_msg.id)}/{quote_plus(get_name(log_msg))}?hash={get_hash(log_msg)}"
hp_link = await get_shortlink(lazy_download)
ph_link = await get_shortlink(lazy_stream)
buttons = []
if await db.has_premium_access(user_id):
buttons = [[
InlineKeyboardButton("🚀 ꜰᴀꜱᴛ ᴅᴏᴡɴʟᴏᴀᴅ", url=lazy_download),
InlineKeyboardButton("ᴡᴀᴛᴄʜ ᴏɴʟɪɴᴇ 🧿", url=lazy_stream)
],[
InlineKeyboardButton('📌 ᴊᴏɪɴ ᴜᴘᴅᴀᴛᴇꜱ ᴄʜᴀɴɴᴇʟ 📌', url='https://t.me/HP_MOVIES_WORLD')
]]
else:
await query.answer("🚸 ɴᴏᴛᴇ :\nᴀᴅ-ꜰʀᴇᴇ ꜱᴇʀᴠɪᴄᴇ ɪꜱ ᴏɴʟʏ ꜰᴏʀ ᴘʀᴇᴍɪᴜᴍ ᴜꜱᴇʀꜱ.\n\nᴛᴏ ᴋɴᴏᴡ ᴍᴏʀᴇ ᴄʜᴇᴄᴋ ᴘʟᴀɴꜱ.", show_alert=True)
await query.message.reply_text(
text="<b>‼️ ᴡᴀɴᴛ ᴛᴏ ʀᴇᴍᴏᴠᴇ ᴀᴅꜱ ?\n\n✅ ᴘᴜʀᴄʜᴀꜱᴇ ᴘʀᴇᴍɪᴜᴍ ᴀɴᴅ ᴇɴᴊᴏʏ ᴀᴅ-ꜰʀᴇᴇ ᴇxᴘᴇʀɪᴇɴᴄᴇ.</b>",
quote=True,
disable_web_page_preview=True,
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("💸 ᴄʜᴇᴄᴋᴏᴜᴛ ᴘʀᴇᴍɪᴜᴍ ᴘʟᴀɴꜱ 💸", callback_data='seeplans')]]))
buttons = [[
InlineKeyboardButton("🚀 ꜰᴀꜱᴛ ᴅᴏᴡɴʟᴏᴀᴅ", url=hp_link),
InlineKeyboardButton("ᴡᴀᴛᴄʜ ᴏɴʟɪɴᴇ 🧿", url=ph_link)
],[
InlineKeyboardButton('❗ʜᴏᴡ ᴛᴏ ᴏᴘᴇɴ ʟɪɴᴋ❗', url=STREAMHTO)
]]
query.message.reply_markup = query.message.reply_markup or []
query.message.reply_markup.inline_keyboard.pop(0)
query.message.reply_markup.inline_keyboard.insert(0, buttons)
await query.message.edit_reply_markup(InlineKeyboardMarkup(buttons))
await log_msg.reply_text(
text=f"#LinkGenrated\n\nIᴅ : <code>{user_id}</code>\nUꜱᴇʀɴᴀᴍᴇ : {username}\n\nNᴀᴍᴇ : {fileName}",
quote=True,
disable_web_page_preview=True,
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("🚀 ꜰᴀꜱᴛ ᴅᴏᴡɴʟᴏᴀᴅ", url=hp_link),
InlineKeyboardButton('ᴡᴀᴛᴄʜ ᴏɴʟɪɴᴇ 🧿', url=ph_link)]]))
except Exception as e:
print(e) # print the error message
await query.answer(f"⚠️ SOMETHING WENT WRONG \n\n{e}", show_alert=True)
return
# don't change anything without contacting me @creatorrio
elif query.data == "pagesn1":
await query.answer(text=script.PAGE_TXT, show_alert=True)
elif query.data == "reqinfo":
await query.answer(text=script.REQINFO, show_alert=True)
elif query.data == "select":
await query.answer(text=script.SELECT, show_alert=True)
elif query.data == "sinfo":
await query.answer(text=script.SINFO, show_alert=True)
elif query.data == "start":
buttons = [[
InlineKeyboardButton('☆ ᴀᴅᴅ ᴍᴇ ᴛᴏ ʏᴏᴜʀ ɢʀᴏᴜᴘ ☆', url=f'http://telegram.me/{temp.U_NAME}?startgroup=true')
],[
InlineKeyboardButton('💸 ᴇᴀʀɴ ᴍᴏɴᴇʏ 💸', callback_data="shortlink_info"),
InlineKeyboardButton('• ᴜᴘᴅᴀᴛᴇꜱ •', callback_data='channels')
],[
InlineKeyboardButton('• ᴄᴏᴍᴍᴀɴᴅꜱ •', callback_data='help'),
InlineKeyboardButton('• ᴀʙᴏᴜᴛ •', callback_data='about')
],[
InlineKeyboardButton('✨ ʙᴜʏ ꜱᴜʙꜱᴄʀɪᴘᴛɪᴏɴ : ʀᴇᴍᴏᴠᴇ ᴀᴅꜱ ✨', callback_data="premium_info")
]]
reply_markup = InlineKeyboardMarkup(buttons)
current_time = datetime.now(pytz.timezone(TIMEZONE))
curr_time = current_time.hour
if curr_time < 12:
gtxt = "ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ 👋"
elif curr_time < 17:
gtxt = "ɢᴏᴏᴅ ᴀғᴛᴇʀɴᴏᴏɴ 👋"
elif curr_time < 21:
gtxt = "ɢᴏᴏᴅ ᴇᴠᴇɴɪɴɢ 👋"
else:
gtxt = "ɢᴏᴏᴅ ɴɪɢʜᴛ 👋"
await query.message.edit_text(
text=script.START_TXT.format(query.from_user.mention, gtxt, temp.U_NAME, temp.B_NAME),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
await query.answer(MSG_ALRT)
elif query.data == "purchase":
buttons = [[
InlineKeyboardButton('💵 ᴘᴀʏ ᴠɪᴀ ᴜᴘɪ ɪᴅ 💵', callback_data='upi_info')
],[
InlineKeyboardButton('📸 ꜱᴄᴀɴ ǫʀ ᴄᴏᴅᴇ 📸', callback_data='qr_info')
],[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ⇋', callback_data='premium_info')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.PURCHASE_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "upi_info":
buttons = [[
InlineKeyboardButton('📲 ꜱᴇɴᴅ ᴘᴀʏᴍᴇɴᴛ ꜱᴄʀᴇᴇɴꜱʜᴏᴛ ʜᴇʀᴇ', user_id=int(767250672))
],[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ⇋', callback_data='purchase')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.UPI_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "qr_info":
buttons = [[
InlineKeyboardButton('📲 ꜱᴇɴᴅ ᴘᴀʏᴍᴇɴᴛ ꜱᴄʀᴇᴇɴꜱʜᴏᴛ ʜᴇʀᴇ', user_id=int(767250672))
],[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ⇋', callback_data='purchase')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.QR_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "seeplans":
btn = [[
InlineKeyboardButton('📲 ꜱᴇɴᴅ ᴘᴀʏᴍᴇɴᴛ ꜱᴄʀᴇᴇɴꜱʜᴏᴛ', user_id=int(767250672))
],[
InlineKeyboardButton('❌ ᴄʟᴏꜱᴇ ❌', callback_data='close_data')
]]
reply_markup = InlineKeyboardMarkup(btn)
await query.message.reply_photo(
photo=(SUBSCRIPTION),
caption=script.PREPLANS_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
# Thanks to @CoderluffyTG for fixing this
elif query.data == "give_trial":
user_id = query.from_user.id
has_free_trial = await db.check_trial_status(user_id)
if has_free_trial:
await query.answer("🚸 ʏᴏᴜ'ᴠᴇ ᴀʟʀᴇᴀᴅʏ ᴄʟᴀɪᴍᴇᴅ ʏᴏᴜʀ ꜰʀᴇᴇ ᴛʀɪᴀʟ ᴏɴᴄᴇ !\n\n📌 ᴄʜᴇᴄᴋᴏᴜᴛ ᴏᴜʀ ᴘʟᴀɴꜱ ʙʏ : /plan", show_alert=True)
return
else:
await db.give_free_trial(user_id)
await query.message.reply_text(
text="<b>🥳 ᴄᴏɴɢʀᴀᴛᴜʟᴀᴛɪᴏɴꜱ\n\n🎉 ʏᴏᴜ ᴄᴀɴ ᴜsᴇ ꜰʀᴇᴇ ᴛʀᴀɪʟ ꜰᴏʀ <u>5 ᴍɪɴᴜᴛᴇs</u> ꜰʀᴏᴍ ɴᴏᴡ !</b>",
quote=False,
disable_web_page_preview=True,
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("💸 ᴄʜᴇᴄᴋᴏᴜᴛ ᴘʀᴇᴍɪᴜᴍ ᴘʟᴀɴꜱ 💸", callback_data='seeplans')]]))
return
elif query.data == "premium_info":
buttons = [[
InlineKeyboardButton('• ꜰʀᴇᴇ ᴛʀɪᴀʟ •', callback_data='free')
],[
InlineKeyboardButton('• ʙʀᴏɴᴢᴇ •', callback_data='broze'),
InlineKeyboardButton('• ꜱɪʟᴠᴇʀ •', callback_data='silver')
],[
InlineKeyboardButton('• ɢᴏʟᴅ •', callback_data='gold'),
InlineKeyboardButton('• ᴘʟᴀᴛɪɴᴜᴍ •', callback_data='platinum')
],[
InlineKeyboardButton('• ᴅɪᴀᴍᴏɴᴅ •', callback_data='diamond'),
InlineKeyboardButton('• ᴏᴛʜᴇʀ •', callback_data='other')
],[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ᴛᴏ ʜᴏᴍᴇ ⇋', callback_data='start')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.PLAN_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "free":
buttons = [[
InlineKeyboardButton('⚜️ ᴄʟɪᴄᴋ ʜᴇʀᴇ ᴛᴏ ɢᴇᴛ ꜰʀᴇᴇ ᴛʀɪᴀʟ', callback_data="give_trial")
],[
InlineKeyboardButton('⋞ ʙᴀᴄᴋ', callback_data='other'),
InlineKeyboardButton('1 / 7', callback_data='pagesn1'),
InlineKeyboardButton('ɴᴇxᴛ ⋟', callback_data='broze')
],[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ⇋', callback_data='premium_info')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.FREE_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "broze":
buttons = [[
InlineKeyboardButton('🔐 ᴄʟɪᴄᴋ ʜᴇʀᴇ ᴛᴏ ʙᴜʏ ᴘʀᴇᴍɪᴜᴍ', callback_data='purchase')
],[
InlineKeyboardButton('⋞ ʙᴀᴄᴋ', callback_data='free'),
InlineKeyboardButton('2 / 7', callback_data='pagesn1'),
InlineKeyboardButton('ɴᴇxᴛ ⋟', callback_data='silver')
],[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ⇋', callback_data='premium_info')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.BRONZE_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "silver":
buttons = [[
InlineKeyboardButton('🔐 ᴄʟɪᴄᴋ ʜᴇʀᴇ ᴛᴏ ʙᴜʏ ᴘʀᴇᴍɪᴜᴍ', callback_data='purchase')
],[
InlineKeyboardButton('⋞ ʙᴀᴄᴋ', callback_data='broze'),
InlineKeyboardButton('3 / 7', callback_data='pagesn1'),
InlineKeyboardButton('ɴᴇxᴛ ⋟', callback_data='gold')
],[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ⇋', callback_data='premium_info')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.SILVER_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "gold":
buttons = [[
InlineKeyboardButton('🔐 ᴄʟɪᴄᴋ ʜᴇʀᴇ ᴛᴏ ʙᴜʏ ᴘʀᴇᴍɪᴜᴍ', callback_data='purchase')
],[
InlineKeyboardButton('⋞ ʙᴀᴄᴋ', callback_data='silver'),
InlineKeyboardButton('4 / 7', callback_data='pagesn1'),
InlineKeyboardButton('ɴᴇxᴛ ⋟', callback_data='platinum')
],[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ⇋', callback_data='premium_info')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.GOLD_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "platinum":
buttons = [[
InlineKeyboardButton('🔐 ᴄʟɪᴄᴋ ʜᴇʀᴇ ᴛᴏ ʙᴜʏ ᴘʀᴇᴍɪᴜᴍ', callback_data='purchase')
],[
InlineKeyboardButton('⋞ ʙᴀᴄᴋ', callback_data='gold'),
InlineKeyboardButton('5 / 7', callback_data='pagesn1'),
InlineKeyboardButton('ɴᴇxᴛ ⋟', callback_data='diamond')
],[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ⇋', callback_data='premium_info')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.PLATINUM_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "diamond":
buttons = [[
InlineKeyboardButton('🔐 ᴄʟɪᴄᴋ ʜᴇʀᴇ ᴛᴏ ʙᴜʏ ᴘʀᴇᴍɪᴜᴍ', callback_data='purchase')
],[
InlineKeyboardButton('⋞ ʙᴀᴄᴋ', callback_data='platinum'),
InlineKeyboardButton('6 / 7', callback_data='pagesn1'),
InlineKeyboardButton('ɴᴇxᴛ ⋟', callback_data='other')
],[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ⇋', callback_data='premium_info')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.DIAMOND_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "other":
buttons = [[
InlineKeyboardButton('☎️ ᴄᴏɴᴛᴀᴄᴛ ᴏᴡɴᴇʀ ᴛᴏ ᴋɴᴏᴡ ᴍᴏʀᴇ', user_id=int(767250672))
],[
InlineKeyboardButton('⋞ ʙᴀᴄᴋ', callback_data='diamond'),
InlineKeyboardButton('7 / 7', callback_data='pagesn1'),
InlineKeyboardButton('ɴᴇxᴛ ⋟', callback_data='free')
],[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ⇋', callback_data='premium_info')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.OTHER_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "channels":
buttons = [[
InlineKeyboardButton('⚜️ ᴜᴘᴅᴀᴛᴇꜱ ᴄʜᴀɴɴᴇʟ ⚜️', url='https://t.me/HP_MOVIES_WORLD')
],[
InlineKeyboardButton('🔍 ɢʀᴏᴜᴘ¹', url='https://t.me/MoviesLinkSearchBot2'),
InlineKeyboardButton('ɢʀᴏᴜᴘ² 🔎', url='https://t.me/MoviesLinkSearchBot3')
],[
InlineKeyboardButton('✉️ ʀᴇǫᴜᴇꜱᴛ ɢʀᴏᴜᴘ ✉️', url='https://t.me/HpMovieRequest')
],[
InlineKeyboardButton('⇇ ʙᴀᴄᴋ', callback_data='start'),
InlineKeyboardButton('ꜱᴜᴘᴘᴏʀᴛ 👮', url='https://t.me/HpRequestBot')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.CHANNELS.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "users":
buttons = [[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ⇋', callback_data='help')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.USERS_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "group":
buttons = [[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ⇋', callback_data='help')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.GROUP_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "admic":
if query.from_user.id not in ADMINS:
return await query.answer("⚠️ ʏᴏᴜ'ʀᴇ ɴᴏᴛ ᴀ ʙᴏᴛ ᴀᴅᴍɪɴ !", show_alert=True)
buttons = [[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ⇋', callback_data='help')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.ADMIC_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "help":
buttons = [[
InlineKeyboardButton('• ʙᴏᴛ ᴀᴅᴍɪɴ ᴄᴏᴍᴍᴀɴᴅꜱ •', callback_data='admic')
], [
InlineKeyboardButton('• ᴜꜱᴇʀ •', callback_data='users'),
InlineKeyboardButton('• ɢʀᴏᴜᴘ •', callback_data='group')
], [
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ᴛᴏ ʜᴏᴍᴇ ⇋', callback_data='start')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.HELP_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "about":
buttons = [[
InlineKeyboardButton('‼️ ᴅɪꜱᴄʟᴀɪᴍᴇʀ ‼️', callback_data='disclaimer'),
], [
InlineKeyboardButton ('• ᴄʀᴇᴅɪᴛꜱ ᴛᴏ ᴛʜᴇ ᴅᴇᴠᴇʟᴏᴘᴇʀꜱ •', callback_data='credits'),
], [
InlineKeyboardButton('• ᴏᴡɴᴇʀ •', user_id=int(767250672)),
InlineKeyboardButton('• ꜱᴛᴀᴛꜱ •', callback_data='stats')
], [
InlineKeyboardButton('🛰️ ʀᴇɴᴅᴇʀɪɴɢ ꜱᴛᴀᴛᴜꜱ ☁️',callback_data='rendr')
], [
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ᴛᴏ ʜᴏᴍᴇ ⇋', callback_data='start')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.ABOUT_TXT.format(temp.B_NAME),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "rendr":
await query.answer("⚡️ ʟɪᴠᴇ sʏsᴛᴇᴍ sᴛᴀᴛᴜs ⚡️\n\n❂ ʀᴀᴍ ●●●●●●●◌◌◌\n✇ ᴄᴘᴜ ●●●●●●●◌◌◌\n✪ ᴅᴀᴛᴀ ᴛʀᴀꜰɪᴄs ●●●●◌◌◌◌◌◌ 🛰\n\nᴠ4.2 [sᴛᴀʙʟᴇ] """, show_alert=True)
elif query.data == "credits":
buttons = [[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ⇋', callback_data='about')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.CREDITS_TXT,
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "stats":
buttons = [[
InlineKeyboardButton('⇇ ʙᴀᴄᴋ', callback_data='about'),
InlineKeyboardButton('⟲ ʀᴇғʀᴇsʜ', callback_data='rfrsh')
]]
reply_markup = InlineKeyboardMarkup(buttons)
total = await Media.count_documents()
users = await db.total_users_count()
chats = await db.total_chat_count()
monsize = await db.get_db_size()
free = 536870912 - monsize
monsize = get_size(monsize)
free = get_size(free)
await query.message.edit_text(
text=script.STATUS_TXT.format(total, users, chats, monsize, free),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "rfrsh":
await query.answer("ꜰᴇᴛᴄʜɪɴɢ ᴍᴏɴɢᴏ-ᴅʙ ᴅᴀᴛᴀʙᴀꜱᴇ...")
buttons = [[
InlineKeyboardButton('⇇ ʙᴀᴄᴋ', callback_data='about'),
InlineKeyboardButton('⟲ ʀᴇғʀᴇsʜ', callback_data='rfrsh')
]]
reply_markup = InlineKeyboardMarkup(buttons)
total = await Media.count_documents()
users = await db.total_users_count()
chats = await db.total_chat_count()
monsize = await db.get_db_size()
free = 536870912 - monsize
monsize = get_size(monsize)
free = get_size(free)
await query.message.edit_text(
text=script.STATUS_TXT.format(total, users, chats, monsize, free),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "shortlink_info":
btn = [[
InlineKeyboardButton("1 / 3", callback_data="pagesn1"),
InlineKeyboardButton("ɴᴇxᴛ ⋟", callback_data="shortlink_info2")
],[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ᴛᴏ ʜᴏᴍᴇ ⇋', callback_data='start')
]]
reply_markup = InlineKeyboardMarkup(btn)
await query.message.edit_text(
text=(script.SHORTLINK_INFO),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "shortlink_info2":
btn = [[
InlineKeyboardButton("⋞ ʙᴀᴄᴋ", callback_data="shortlink_info"),
InlineKeyboardButton("2 / 3", callback_data="pagesn1"),
InlineKeyboardButton("ɴᴇxᴛ ⋟", callback_data="shortlink_info3")
],[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ᴛᴏ ʜᴏᴍᴇ ⇋', callback_data='start')
]]
reply_markup = InlineKeyboardMarkup(btn)
await query.message.edit_text(
text=(script.SHORTLINK_INFO2),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "shortlink_info3":
btn = [[
InlineKeyboardButton("⋞ ʙᴀᴄᴋ", callback_data="shortlink_info2"),
InlineKeyboardButton("3 / 3", callback_data="pagesn1")
],[
InlineKeyboardButton('⇋ ʙᴀᴄᴋ ᴛᴏ ʜᴏᴍᴇ ⇋', callback_data='start')
]]
reply_markup = InlineKeyboardMarkup(btn)
await query.message.edit_text(
text=(script.SHORTLINK_INFO3),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "disclaimer":
btn = [[
InlineKeyboardButton("⇋ ʙᴀᴄᴋ ⇋", callback_data="about")
]]
reply_markup = InlineKeyboardMarkup(btn)
await query.message.edit_text(
text=(script.DISCLAIMER_TXT),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data.startswith("setgs"):
ident, set_type, status, grp_id = query.data.split("#")
grpid = await active_connection(str(query.from_user.id))
if str(grp_id) != str(grpid):
await query.message.edit("Yᴏᴜʀ Aᴄᴛɪᴠᴇ Cᴏɴɴᴇᴄᴛɪᴏɴ Hᴀs Bᴇᴇɴ Cʜᴀɴɢᴇᴅ. Gᴏ Tᴏ /connections ᴀɴᴅ ᴄʜᴀɴɢᴇ ʏᴏᴜʀ ᴀᴄᴛɪᴠᴇ ᴄᴏɴɴᴇᴄᴛɪᴏɴ.")
return await query.answer(MSG_ALRT)
if set_type == 'is_shortlink' and query.from_user.id not in ADMINS:
return await query.answer(text=f"Hey {query.from_user.first_name}, You can't change shortlink settings for your group !\n\nIt's an admin only setting !", show_alert=True)
if status == "True":
await save_group_settings(grpid, set_type, False)
else:
await save_group_settings(grpid, set_type, True)
settings = await get_settings(grpid)
if settings is not None:
buttons = [
[
InlineKeyboardButton('ʀᴇꜱᴜʟᴛ ᴘᴀɢᴇ',
callback_data=f'setgs#button#{settings["button"]}#{str(grp_id)}'),
InlineKeyboardButton('ʙᴜᴛᴛᴏɴ' if settings["button"] else 'ᴛᴇxᴛ',
callback_data=f'setgs#button#{settings["button"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ꜰɪʟᴇ ꜱᴇɴᴅ ᴍᴏᴅᴇ', callback_data=f'setgs#botpm#{settings["botpm"]}#{str(grp_id)}'),
InlineKeyboardButton('ꜱᴛᴀʀᴛ' if settings["botpm"] else 'ᴀᴜᴛᴏ',
callback_data=f'setgs#botpm#{settings["botpm"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ꜰɪʟᴇ ꜱᴇᴄᴜʀᴇ',
callback_data=f'setgs#file_secure#{settings["file_secure"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["file_secure"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#file_secure#{settings["file_secure"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ɪᴍᴅʙ ᴘᴏꜱᴛᴇʀ', callback_data=f'setgs#imdb#{settings["imdb"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["imdb"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#imdb#{settings["imdb"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ꜱᴘᴇʟʟ ᴄʜᴇᴄᴋ',
callback_data=f'setgs#spell_check#{settings["spell_check"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["spell_check"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#spell_check#{settings["spell_check"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ᴡᴇʟᴄᴏᴍᴇ ᴍꜱɢ', callback_data=f'setgs#welcome#{settings["welcome"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["welcome"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#welcome#{settings["welcome"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ᴀᴜᴛᴏ ᴅᴇʟᴇᴛᴇ',
callback_data=f'setgs#auto_delete#{settings["auto_delete"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["auto_delete"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#auto_delete#{settings["auto_delete"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ᴀᴜᴛᴏ ꜰɪʟᴛᴇʀ',
callback_data=f'setgs#auto_ffilter#{settings["auto_ffilter"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["auto_ffilter"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#auto_ffilter#{settings["auto_ffilter"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ᴍᴀx ʙᴜᴛᴛᴏɴꜱ',
callback_data=f'setgs#max_btn#{settings["max_btn"]}#{str(grp_id)}'),
InlineKeyboardButton('10' if settings["max_btn"] else f'{MAX_B_TN}',
callback_data=f'setgs#max_btn#{settings["max_btn"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('ꜱʜᴏʀᴛʟɪɴᴋ',
callback_data=f'setgs#is_shortlink#{settings["is_shortlink"]}#{str(grp_id)}'),
InlineKeyboardButton('ᴇɴᴀʙʟᴇ' if settings["is_shortlink"] else 'ᴅɪꜱᴀʙʟᴇ',
callback_data=f'setgs#is_shortlink#{settings["is_shortlink"]}#{str(grp_id)}')
],
[
InlineKeyboardButton('⇋ ᴄʟᴏꜱᴇ ꜱᴇᴛᴛɪɴɢꜱ ᴍᴇɴᴜ ⇋',
callback_data='close_data'
)
]
]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_reply_markup(reply_markup)
await query.answer(MSG_ALRT)
async def auto_filter(client, msg, spoll=False):
curr_time = datetime.now(pytz.timezone('Asia/Kolkata')).time()
# reqstr1 = msg.from_user.id if msg.from_user else 0
# reqstr = await client.get_users(reqstr1)
if not spoll:
message = msg
if message.text.startswith("/"): return # ignore commands
if re.findall("((^\/|^,|^!|^\.|^[\U0001F600-\U000E007F]).*)", message.text):
return
if len(message.text) < 100:
search = message.text
m=await message.reply_sticker("CAACAgQAAxkBAAEKSxplArIUActk4ORQuFn3DHFvBqQCOgACBQMAAnJxFyVYcSIunXgGjjAE",
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(f'Seaching for {search} 🔎', url=f"https://t.me/HP_MOVIES_WORLD")]])
)
search = search.lower()
find = search.split(" ")
search = ""
removes = ["in","upload", "series", "full", "horror", "thriller", "mystery", "print", "file"]
for x in find:
if x in removes:
continue
else:
search = search + x + " "
search = re.sub(r"\b(pl(i|e)*?(s|z+|ease|se|ese|(e+)s(e)?)|((send|snd|giv(e)?|gib)(\sme)?)|movie(s)?|new|latest|bro|bruh|broh|helo|that|find|dubbed|link|venum|iruka|pannunga|pannungga|anuppunga|anupunga|anuppungga|anupungga|film|undo|kitti|kitty|tharu|kittumo|kittum|movie|any(one)|with\ssubtitle(s)?)", "", search, flags=re.IGNORECASE)
search = re.sub(r"\s+", " ", search).strip()
search = search.replace("-", " ")
search = search.replace(":","")
files, offset, total_results = await get_search_results(message.chat.id ,search, offset=0, filter=True)
settings = await get_settings(message.chat.id)
if not files:
await m.delete()
if settings["spell_check"]:
return await advantage_spell_chok(client, msg)
else:
# if NO_RESULTS_MSG:
# await client.send_message(chat_id=LOG_CHANNEL, text=(script.NORSLTS.format(reqstr.id, reqstr.mention, search)))
return
else:
return
else:
message = msg.message.reply_to_message # msg will be callback query
search, files, offset, total_results = spoll
m=await message.reply_sticker("CAACAgQAAxkBAAEKSxplArIUActk4ORQuFn3DHFvBqQCOgACBQMAAnJxFyVYcSIunXgGjjAE",
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(f'Seaching for {search} 🔎', url=f"https://t.me/HP_MOVIES_WORLD")]])
)
settings = await get_settings(message.chat.id)
await msg.message.delete()
pre = 'filep' if settings['file_secure'] else 'file'
key = f"{message.chat.id}-{message.id}"
FRESH[key] = search
temp.GETALL[key] = files
temp.SHORT[message.from_user.id] = message.chat.id
if settings["button"]:
btn = [
[
InlineKeyboardButton(
text=f"📁 {get_size(file.file_size)} ▷ {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file.file_name.split()))}", callback_data=f'{pre}#{file.file_id}'
),
]
for file in files
]
btn.insert(0,
[
InlineKeyboardButton("⇈ ꜱᴇʟᴇᴄᴛ ᴏᴘᴛɪᴏɴꜱ ʜᴇʀᴇ ⇈", 'reqinfo')
]
)
btn.insert(0,
[
InlineKeyboardButton(f'ǫᴜᴀʟɪᴛʏ', callback_data=f"qualities#{key}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇ", callback_data=f"languages#{key}"),
InlineKeyboardButton("ꜱᴇᴀsᴏɴ", callback_data=f"seasons#{key}")
]
)
btn.insert(0, [
InlineKeyboardButton("♨️ ꜱᴇɴᴅ ᴀʟʟ ꜰɪʟᴇꜱ ♨️", callback_data=f"sendfiles#{key}")
])
else:
btn = []
btn.insert(0,
[
InlineKeyboardButton("⇈ ꜱᴇʟᴇᴄᴛ ᴏᴘᴛɪᴏɴꜱ ʜᴇʀᴇ ⇈", 'reqinfo')
]
)
btn.insert(0,
[
InlineKeyboardButton(f'ǫᴜᴀʟɪᴛʏ', callback_data=f"qualities#{key}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇ", callback_data=f"languages#{key}"),
InlineKeyboardButton("ꜱᴇᴀsᴏɴ", callback_data=f"seasons#{key}")
]
)
btn.insert(0, [
InlineKeyboardButton("♨️ ꜱᴇɴᴅ ᴀʟʟ ꜰɪʟᴇꜱ ♨️", callback_data=f"sendfiles#{key}")
])
if offset != "":
req = message.from_user.id if message.from_user else 0
try:
if settings['max_btn']:
btn.append(
[InlineKeyboardButton("ᴘᴀɢᴇ", callback_data="pages"), InlineKeyboardButton(text=f"1/{math.ceil(int(total_results)/10)}",callback_data="pages"), InlineKeyboardButton(text="ɴᴇxᴛ ⋟",callback_data=f"next_{req}_{key}_{offset}")]
)
else:
btn.append(
[InlineKeyboardButton("ᴘᴀɢᴇ", callback_data="pages"), InlineKeyboardButton(text=f"1/{math.ceil(int(total_results)/int(MAX_B_TN))}",callback_data="pages"), InlineKeyboardButton(text="ɴᴇxᴛ ⋟",callback_data=f"next_{req}_{key}_{offset}")]
)
except KeyError:
await save_group_settings(message.chat.id, 'max_btn', True)
btn.append(
[InlineKeyboardButton("ᴘᴀɢᴇ", callback_data="pages"), InlineKeyboardButton(text=f"1/{math.ceil(int(total_results)/10)}",callback_data="pages"), InlineKeyboardButton(text="ɴᴇxᴛ ⋟",callback_data=f"next_{req}_{key}_{offset}")]
)
else:
btn.append(
[InlineKeyboardButton(text="↭ ɴᴏ ᴍᴏʀᴇ ᴘᴀɢᴇꜱ ᴀᴠᴀɪʟᴀʙʟᴇ ↭",callback_data="pages")]
)
imdb = await get_poster(search, file=(files[0]).file_name) if settings["imdb"] else None
cur_time = datetime.now(pytz.timezone('Asia/Kolkata')).time()
time_difference = timedelta(hours=cur_time.hour, minutes=cur_time.minute, seconds=(cur_time.second+(cur_time.microsecond/1000000))) - timedelta(hours=curr_time.hour, minutes=curr_time.minute, seconds=(curr_time.second+(curr_time.microsecond/1000000)))
remaining_seconds = "{:.2f}".format(time_difference.total_seconds())
TEMPLATE = script.IMDB_TEMPLATE_TXT
if imdb:
cap = TEMPLATE.format(
qurey=search,
title=imdb['title'],
votes=imdb['votes'],
aka=imdb["aka"],
seasons=imdb["seasons"],
box_office=imdb['box_office'],
localized_title=imdb['localized_title'],
kind=imdb['kind'],
imdb_id=imdb["imdb_id"],
cast=imdb["cast"],
runtime=imdb["runtime"],
countries=imdb["countries"],
certificates=imdb["certificates"],
languages=imdb["languages"],
director=imdb["director"],
writer=imdb["writer"],
producer=imdb["producer"],
composer=imdb["composer"],
cinematographer=imdb["cinematographer"],
music_team=imdb["music_team"],
distributors=imdb["distributors"],
release_date=imdb['release_date'],
year=imdb['year'],
genres=imdb['genres'],
poster=imdb['poster'],
plot=imdb['plot'],
rating=imdb['rating'],
url=imdb['url'],
**locals()
)
temp.IMDB_CAP[message.from_user.id] = cap
if not settings["button"]:
cap+="\n\n<b>📚 <u>Your Requested Files</u> 👇\n\n</b>"
for file in files:
cap += f"<b>\n<a href='https://telegram.me/{temp.U_NAME}?start=files_{file.file_id}'> 📁 {get_size(file.file_size)} ▷ {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file.file_name.split()))}\n</a></b>"
else:
if settings["button"]:
cap = f"<b>🧿 ᴛɪᴛʟᴇ : <code>{search}</code>\n📂 ᴛᴏᴛᴀʟ ꜰɪʟᴇꜱ : <code>{total_results}</code>\n📝 ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ : {message.from_user.mention}\n⏰ ʀᴇsᴜʟᴛ ɪɴ : <code>{remaining_seconds} Sᴇᴄᴏɴᴅs</code>\n⚜️ ᴘᴏᴡᴇʀᴇᴅ ʙʏ : 👇\n⚡ {message.chat.title} \n\n</b>"
else:
cap = f"<b>🧿 ᴛɪᴛʟᴇ : <code>{search}</code>\n📂 ᴛᴏᴛᴀʟ ꜰɪʟᴇꜱ : <code>{total_results}</code>\n📝 ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ : {message.from_user.mention}\n⏰ ʀᴇsᴜʟᴛ ɪɴ : <code>{remaining_seconds} Sᴇᴄᴏɴᴅs</code>\n⚜️ ᴘᴏᴡᴇʀᴇᴅ ʙʏ : 👇\n⚡ {message.chat.title} \n\n</b>"
# cap+="<b>Hᴇʏ {message.from_user.mention}, Hᴇʀᴇ ɪs ᴛʜᴇ ʀᴇsᴜʟᴛ ғᴏʀ ʏᴏᴜʀ ᴏ̨ᴜᴇʀʏ {search} \n\n</b>"
for file in files:
cap += f"<b><a href='https://telegram.me/{temp.U_NAME}?start=files_{file.file_id}'> 📁 {get_size(file.file_size)} ▷ {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file.file_name.split()))}\n\n</a></b>"
if imdb and imdb.get('poster'):
try:
hehe = await message.reply_photo(photo=imdb.get('poster'), caption=cap, reply_markup=InlineKeyboardMarkup(btn))
await m.delete()
try:
if settings['auto_delete']:
await asyncio.sleep(300)
await hehe.delete()
await message.delete()
except KeyError:
await save_group_settings(message.chat.id, 'auto_delete', True)
await asyncio.sleep(300)
await hehe.delete()
await message.delete()
except (MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty):
pic = imdb.get('poster')
poster = pic.replace('.jpg', "._V1_UX360.jpg")
hmm = await message.reply_photo(photo=poster, caption=cap, reply_markup=InlineKeyboardMarkup(btn))
await m.delete()
try:
if settings['auto_delete']:
await asyncio.sleep(300)
m=await message.reply_text("🔎")
await hmm.delete()
await message.delete()
except KeyError:
await save_group_settings(message.chat.id, 'auto_delete', True)
await asyncio.sleep(300)
await hmm.delete()
await message.delete()
except Exception as e:
logger.exception(e)
m=await message.reply_text("🔎")
fek = await message.reply_text(text=cap, reply_markup=InlineKeyboardMarkup(btn))
await m.delete()
try:
if settings['auto_delete']:
await asyncio.sleep(300)
await fek.delete()
await message.delete()
except KeyError:
await save_group_settings(message.chat.id, 'auto_delete', True)
await asyncio.sleep(300)
await fek.delete()
await message.delete()
else:
fuk = await message.reply_text(text=cap, reply_markup=InlineKeyboardMarkup(btn), disable_web_page_preview=True)
await m.delete()
try:
if settings['auto_delete']:
await asyncio.sleep(300)
await fuk.delete()
await message.delete()
except KeyError:
await save_group_settings(message.chat.id, 'auto_delete', True)
await asyncio.sleep(300)
await fuk.delete()
await message.delete()
async def advantage_spell_chok(client, msg):
mv_id = msg.id
mv_rqst = msg.text
reqstr1 = msg.from_user.id if msg.from_user else 0
reqstr = await client.get_users(reqstr1)
settings = await get_settings(msg.chat.id)
find = mv_rqst.split(" ")
query = ""
removes = ["in","upload", "series", "full", "horror", "thriller", "mystery", "print", "file"]
for x in find:
if x in removes:
continue
else:
query = query + x + " "
query = re.sub(r"\b(pl(i|e)*?(s|z+|ease|se|ese|(e+)s(e)?)|((send|snd|giv(e)?|gib)(\sme)?)|movie(s)?|new|latest|bro|bruh|broh|helo|that|find|dubbed|link|venum|iruka|pannunga|pannungga|anuppunga|anupunga|anuppungga|anupungga|film|undo|kitti|kitty|tharu|kittumo|kittum|movie|any(one)|with\ssubtitle(s)?)", "", query, flags=re.IGNORECASE)
query = re.sub(r"\s+", " ", query).strip() + "movie"
try:
g_s = await search_gagala(query)
g_s += await search_gagala(msg.text)
gs_parsed = []
if not g_s:
reqst_gle = query.replace(" ", "+")
button = [[
InlineKeyboardButton("📝 ʀᴇǫᴜᴇꜱᴛ ʜᴇʀᴇ", url=f"https://t.me/HpMovieRequest")
]]
if NO_RESULTS_MSG:
await client.send_message(chat_id=LOG_CHANNEL, text=(script.NORSLTS.format(reqstr.id, reqstr.mention, mv_rqst)))
k = await msg.reply_text(
text=script.I_CUDNT.format(mv_rqst),
reply_markup=InlineKeyboardMarkup(button)
)
await asyncio.sleep(30)
await k.delete()
return
regex = re.compile(r".*(imdb|wikipedia).*", re.IGNORECASE) # look for imdb / wiki results
gs = list(filter(regex.match, g_s))
gs_parsed = [re.sub(
r'\b(\-([a-zA-Z-\s])\-\simdb|(\-\s)?imdb|(\-\s)?wikipedia|\(|\)|\-|reviews|full|all|episode(s)?|film|movie|series)',
'', i, flags=re.IGNORECASE) for i in gs]
if not gs_parsed:
reg = re.compile(r"watch(\s[a-zA-Z0-9_\s\-\(\)]*)*\|.*",
re.IGNORECASE) # match something like Watch Niram | Amazon Prime
for mv in g_s:
match = reg.match(mv)
if match:
gs_parsed.append(match.group(1))
movielist = []
gs_parsed = list(dict.fromkeys(gs_parsed)) # removing duplicates https://stackoverflow.com/a/7961425
if len(gs_parsed) > 3:
gs_parsed = gs_parsed[:3]
if gs_parsed:
for mov in gs_parsed:
imdb_s = await get_poster(mov.strip(), bulk=True) # searching each keyword in imdb
if imdb_s:
movielist += [movie.get('title') for movie in imdb_s]
movielist += [(re.sub(r'(\-|\(|\)|_)', '', i, flags=re.IGNORECASE)).strip() for i in gs_parsed]
movielist = list(dict.fromkeys(movielist)) # removing duplicates
if not movielist:
reqst_gle = query.replace(" ", "+")
button = [[
InlineKeyboardButton("📝 ʀᴇǫᴜᴇꜱᴛ ʜᴇʀᴇ", url=f"https://t.me/HpMovieRequest")
]]
if NO_RESULTS_MSG:
await client.send_message(chat_id=LOG_CHANNEL, text=(script.NORSLTS.format(reqstr.id, reqstr.mention, mv_rqst)))
k = await msg.reply_text(
text=script.I_CUDNT.format(mv_rqst),
reply_markup=InlineKeyboardMarkup(button)
)
await asyncio.sleep(30)
await k.delete()
return
SPELL_CHECK[mv_id] = movielist
btn = [[
InlineKeyboardButton(
text=movie.strip(),
callback_data=f"spolling#{reqstr1}#{k}",
)
] for k, movie in enumerate(movielist)]
btn.append([InlineKeyboardButton(text="↭ ᴄʟᴏꜱᴇ ↭", callback_data=f'spol#{reqstr1}#close_spellcheck')])
spell_check_del = await msg.reply_text(
text=script.CUDNT_FND.format(mv_rqst),
reply_markup=InlineKeyboardMarkup(btn)
)
try:
if settings['auto_delete']:
await asyncio.sleep(60)
await spell_check_del.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await asyncio.sleep(60)
await spell_check_del.delete()
except:
try:
movies = await get_poster(mv_rqst, bulk=True)
except Exception as e:
logger.exception(e)
reqst_gle = mv_rqst.replace(" ", "+")
button = [[
InlineKeyboardButton("📝 ʀᴇǫᴜᴇꜱᴛ ʜᴇʀᴇ", url=f"https://t.me/HpMovieRequest")
]]
if NO_RESULTS_MSG:
await client.send_message(chat_id=LOG_CHANNEL, text=(script.NORSLTS.format(reqstr.id, reqstr.mention, mv_rqst)))
k = await msg.reply_text(
text=script.I_CUDNT.format(mv_rqst),
reply_markup=InlineKeyboardMarkup(button)
)
await asyncio.sleep(30)
await k.delete()
return
movielist = []
if not movies:
reqst_gle = mv_rqst.replace(" ", "+")
button = [[
InlineKeyboardButton("📝 ʀᴇǫᴜᴇꜱᴛ ʜᴇʀᴇ", url=f"https://t.me/HpMovieRequest")
]]
if NO_RESULTS_MSG:
await client.send_message(chat_id=LOG_CHANNEL, text=(script.NORSLTS.format(reqstr.id, reqstr.mention, mv_rqst)))
k = await msg.reply_text(
text=script.I_CUDNT.format(mv_rqst),
reply_markup=InlineKeyboardMarkup(button)
)
await asyncio.sleep(30)
await k.delete()
return
movielist += [movie.get('title') for movie in movies]
movielist += [f"{movie.get('title')} {movie.get('year')}" for movie in movies]
SPELL_CHECK[mv_id] = movielist
btn = [
[
InlineKeyboardButton(
text=movie_name.strip(),
callback_data=f"spol#{reqstr1}#{k}",
)
]
for k, movie_name in enumerate(movielist)
]
btn.append([InlineKeyboardButton(text="↭ ᴄʟᴏꜱᴇ ↭", callback_data=f'spol#{reqstr1}#close_spellcheck')])
spell_check_del = await msg.reply_text(
text=script.CUDNT_FND.format(mv_rqst),
reply_markup=InlineKeyboardMarkup(btn)
)
try:
if settings['auto_delete']:
await asyncio.sleep(600)
await spell_check_del.delete()
except KeyError:
grpid = await active_connection(str(msg.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(msg.chat.id)
if settings['auto_delete']:
await asyncio.sleep(600)
await spell_check_del.delete()
async def manual_filters(client, message, text=False):
settings = await get_settings(message.chat.id)
group_id = message.chat.id
name = text or message.text
reply_id = message.reply_to_message.id if message.reply_to_message else message.id
keywords = await get_filters(group_id)
for keyword in reversed(sorted(keywords, key=len)):
pattern = r"( |^|[^\w])" + re.escape(keyword) + r"( |$|[^\w])"
if re.search(pattern, name, flags=re.IGNORECASE):
reply_text, btn, alert, fileid = await find_filter(group_id, keyword)
if reply_text:
reply_text = reply_text.replace("\\n", "\n").replace("\\t", "\t")
if btn is not None:
try:
if fileid == "None":
if btn == "[]":
joelkb = await client.send_message(
group_id,
reply_text,
disable_web_page_preview=True,
protect_content=True if settings["file_secure"] else False,
reply_to_message_id=reply_id
)
try:
if settings['auto_ffilter']:
await auto_filter(client, message)
try:
if settings['auto_delete']:
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await joelkb.delete()
else:
try:
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_ffilter', True)
settings = await get_settings(message.chat.id)
if settings['auto_ffilter']:
await auto_filter(client, message)
else:
button = eval(btn)
joelkb = await client.send_message(
group_id,
reply_text,
disable_web_page_preview=True,
reply_markup=InlineKeyboardMarkup(button),
protect_content=True if settings["file_secure"] else False,
reply_to_message_id=reply_id
)
try:
if settings['auto_ffilter']:
await auto_filter(client, message)
try:
if settings['auto_delete']:
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await joelkb.delete()
else:
try:
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_ffilter', True)
settings = await get_settings(message.chat.id)
if settings['auto_ffilter']:
await auto_filter(client, message)
elif btn == "[]":
joelkb = await client.send_cached_media(
group_id,
fileid,
caption=reply_text or "",
protect_content=True if settings["file_secure"] else False,
reply_to_message_id=reply_id
)
try:
if settings['auto_ffilter']:
await auto_filter(client, message)
try:
if settings['auto_delete']:
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await joelkb.delete()
else:
try:
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_ffilter', True)
settings = await get_settings(message.chat.id)
if settings['auto_ffilter']:
await auto_filter(client, message)
else:
button = eval(btn)
joelkb = await message.reply_cached_media(
fileid,
caption=reply_text or "",
reply_markup=InlineKeyboardMarkup(button),
reply_to_message_id=reply_id
)
try:
if settings['auto_ffilter']:
await auto_filter(client, message)
try:
if settings['auto_delete']:
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await joelkb.delete()
else:
try:
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_ffilter', True)
settings = await get_settings(message.chat.id)
if settings['auto_ffilter']:
await auto_filter(client, message)
except Exception as e:
logger.exception(e)
break
else:
return False
async def global_filters(client, message, text=False):
settings = await get_settings(message.chat.id)
group_id = message.chat.id
name = text or message.text
reply_id = message.reply_to_message.id if message.reply_to_message else message.id
keywords = await get_gfilters('gfilters')
for keyword in reversed(sorted(keywords, key=len)):
pattern = r"( |^|[^\w])" + re.escape(keyword) + r"( |$|[^\w])"
if re.search(pattern, name, flags=re.IGNORECASE):
reply_text, btn, alert, fileid = await find_gfilter('gfilters', keyword)
if reply_text:
reply_text = reply_text.replace("\\n", "\n").replace("\\t", "\t")
if btn is not None:
try:
if fileid == "None":
if btn == "[]":
joelkb = await client.send_message(
group_id,
reply_text,
disable_web_page_preview=True,
reply_to_message_id=reply_id
)
manual = await manual_filters(client, message)
if manual == False:
settings = await get_settings(message.chat.id)
try:
if settings['auto_ffilter']:
await auto_filter(client, message)
try:
if settings['auto_delete']:
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await joelkb.delete()
else:
try:
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_ffilter', True)
settings = await get_settings(message.chat.id)
if settings['auto_ffilter']:
await auto_filter(client, message)
else:
try:
if settings['auto_delete']:
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await joelkb.delete()
else:
button = eval(btn)
joelkb = await client.send_message(
group_id,
reply_text,
disable_web_page_preview=True,
reply_markup=InlineKeyboardMarkup(button),
reply_to_message_id=reply_id
)
manual = await manual_filters(client, message)
if manual == False:
settings = await get_settings(message.chat.id)
try:
if settings['auto_ffilter']:
await auto_filter(client, message)
try:
if settings['auto_delete']:
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await joelkb.delete()
else:
try:
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_ffilter', True)
settings = await get_settings(message.chat.id)
if settings['auto_ffilter']:
await auto_filter(client, message)
else:
try:
if settings['auto_delete']:
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await joelkb.delete()
elif btn == "[]":
joelkb = await client.send_cached_media(
group_id,
fileid,
caption=reply_text or "",
reply_to_message_id=reply_id
)
manual = await manual_filters(client, message)
if manual == False:
settings = await get_settings(message.chat.id)
try:
if settings['auto_ffilter']:
await auto_filter(client, message)
try:
if settings['auto_delete']:
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await joelkb.delete()
else:
try:
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_ffilter', True)
settings = await get_settings(message.chat.id)
if settings['auto_ffilter']:
await auto_filter(client, message)
else:
try:
if settings['auto_delete']:
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await joelkb.delete()
else:
button = eval(btn)
joelkb = await message.reply_cached_media(
fileid,
caption=reply_text or "",
reply_markup=InlineKeyboardMarkup(button),
reply_to_message_id=reply_id
)
manual = await manual_filters(client, message)
if manual == False:
settings = await get_settings(message.chat.id)
try:
if settings['auto_ffilter']:
await auto_filter(client, message)
try:
if settings['auto_delete']:
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await joelkb.delete()
else:
try:
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await asyncio.sleep(600)
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_ffilter', True)
settings = await get_settings(message.chat.id)
if settings['auto_ffilter']:
await auto_filter(client, message)
else:
try:
if settings['auto_delete']:
await joelkb.delete()
except KeyError:
grpid = await active_connection(str(message.from_user.id))
await save_group_settings(grpid, 'auto_delete', True)
settings = await get_settings(message.chat.id)
if settings['auto_delete']:
await joelkb.delete()
except Exception as e:
logger.exception(e)
break
else:
return False
|