├── Dockerfile ├── LICENSE ├── Procfile ├── README.md ├── Script.py ├── TechVJ ├── __init__.py ├── bot │ ├── TechVJ │ ├── __init__.py │ └── clients.py ├── server │ ├── TechVJ │ ├── __init__.py │ ├── exceptions.py │ └── stream_routes.py ├── template │ ├── TechVJ │ ├── dl.html │ └── req.html └── utils │ ├── TechVJ │ ├── config_parser.py │ ├── custom_dl.py │ ├── file_properties.py │ ├── file_size.py │ ├── human_readable.py │ ├── keepalive.py │ ├── render_template.py │ └── time_format.py ├── app.py ├── bot.py ├── clone_plugins ├── TechVJ ├── broadcast.py ├── commands.py ├── dbusers.py ├── genlink.py └── users_api.py ├── config.py ├── logging.conf ├── plugins ├── TechVJ ├── broadcast.py ├── clone.py ├── commands.py ├── dbusers.py ├── genlink.py └── users_api.py ├── requirements.txt ├── run cmd.txt ├── runtime.txt └── utils.py /Dockerfile: -------------------------------------------------------------------------------- 1 | # Don't Remove Credit @VJ_Botz 2 | # Subscribe YouTube Channel For Amazing Bot @Tech_VJ 3 | # Ask Doubt on telegram @KingVJ01 4 | 5 | FROM python:3.10.8-slim-buster 6 | 7 | RUN apt update && apt upgrade -y 8 | RUN apt install git -y 9 | COPY requirements.txt /requirements.txt 10 | 11 | RUN cd / 12 | RUN pip3 install -U pip && pip3 install -U -r requirements.txt 13 | RUN mkdir /VJ-File-Store 14 | WORKDIR /VJ-File-Store 15 | COPY . /VJ-File-Store 16 | CMD ["python", "bot.py"] 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: python3 bot.py 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | VJ-FILE-STORE-BOT Logo 3 |

4 |

5 | VJ FILE STORE BOT 6 |

7 | 8 | ![Typing SVG](https://readme-typing-svg.herokuapp.com/?lines=Welcome+To+VJ-FILE-STORE-BOT;A+Highly+Advance+File+Store+Bot;Made+By+Yt-@Tech_VJ!;With+Clone+Feature+Stream/Download+Link;Custom+Url+Shortner+Auto+Delete+Feature;A+Bot+With+Fully+Advanced+Feature!;Thank+You!) 9 |

10 | 11 | ### Deploy Tutorial [Video Link](https://youtu.be/VxAn9VcYtQg) 12 | 13 | ## Features 14 | 15 |
Tap On Me For Bot Features 16 | 17 | - [x] Permanent Link By Using Website [ Premium Feature] 18 | - [x] Clone Feature Added [ Premium Feature] 19 | - [x] Token Verification Feature 20 | - [x] Stram Feature Added With Many Player Support 21 | - [x] Custom Url Shortner Support Any User Can Add His Own Shortner 22 | - [x] Batch Support Added, Any User Can Use Batch By Making Bot Admin In His File Store Channel 23 | - [x] Auto Delete Feature Added 24 | - [x] Custom Start Message With Picture And Buttons 25 | 26 |
27 | 28 | ## Environment Variables 29 | 30 |
Tap On Me For Environment Variable 31 | 32 | - `API_ID` : Get From [my.telegram.org](https://my.telegram.org) 33 | - `API_HASH` : Get From [my.telegram.org](https://my.telegram.org) 34 | - `BOT_TOKEN` : Get From [BotFather](https://telegram.me/BotFather) 35 | - `BOT_USERNAME` : Your Bot Username Without @ 36 | - `DB_URI` : Mongodb Database Url For Main Bot [Tutorial Watch Here](https://youtu.be/DAHRmFdw99o) 37 | - `CLONE_DB_URI` : Mongodb Database Url For Clone Bot [Tutorial Watch Here](https://youtu.be/DAHRmFdw99o) 38 | - `ADMINS` : It mean Admin/Owner Id For Broadcasting Message. 39 | - `LOG_CHANNEL` : Log channel id start with -100xxxxxx 40 | - `URL` : Your Server App Link With https:// and in last make sure one / is given. 41 | - `AUTO_DELETE` : Time In Minutes 42 | - `AUTO_DELETE_TIME` : Time In Seconds 43 | - `PYTHON_VERSION` : This Variable Is Only For Render, Value IS `3.10.8` 44 | - `PORT` : This Variable Is Only For Render, Value IS `8080` 45 | 46 |
47 | 48 | ## See How Bot Look Like 49 | 50 |
Tap On Me For Demo Bot 51 | 52 | Bot Demo 53 | Bot Demo 54 | Bot Demo 55 | Bot Demo 56 | Bot Demo 57 |
58 | 59 | ## Command To Use Bot 60 | 61 |
Tap On Me For Bot Commands 62 | 63 | 🖍️ Main Bot Commands :- 64 | 65 | - `/start` : By This Command You Can Check Bot Is Alive Or Not 66 | - `/link` : By This Command You Can Generate A Shareable Link Of File By Replying This Command To That File 67 | - `/batch` : By This Command You Can Generate Multiple File Shareable Link At A Time [Use Like This /batch (first post link) (last post link)] 68 | - `/base_site` : By This Command You Can Set Your Url Shortner Domain [Use Like This /base_site domain.com] 69 | - `/api` : By This Command You Can Set Your Url Shortner Api [Use Like This /api (your api key)] 70 | - `/deletecloned` : By This Command You Can Delete Your Cloned Bot [Use Like This /deletecloned (your bot token)] 71 | - `/broadcast` : By Using This Command You Can Broadcast A Message To Your Bot User, Reply This Command To Broadcast Message [Owner Only Command] 72 | 73 | 🖍️ Clone Bot Commands :- 74 | 75 | - `/start` : By This Command You Can Check Bot Is Alive Or Not 76 | - `/link` : By This Command You Can Generate A Shareable Link Of File By Replying This Command To That File 77 | - `/base_site` : By This Command You Can Set Your Url Shortner Domain [Use Like This /base_site domain.com] 78 | - `/api` : By This Command You Can Set Your Url Shortner Api [Use Like This /api (your api key)] 79 | - `/broadcast` : By Using This Command You Can Broadcast A Message To Your Bot User, Reply This Command To Broadcast Message [Clone Bot Owner Only Command] 80 | 81 | 82 |
83 | 84 | ## Credit 85 | 86 |
Tap On Me For See Credit 87 | 88 | 💝 Credit Goes To [Tech VJ](https://telegram.me/Kingvj01) 89 | 90 | 🖍️ This Code Is Fully Written Or Coded And Public By [Tech VJ](https://telegram.me/Kingvj01) So Don't Forgot To Give Credit 91 | 92 | 💖 And Thank You So Much To All Who Help In This Journey 💕 93 | 94 | Copyright ©️ [Tech VJ](https://telegram.me/Kingvj01) 95 | 96 | 97 |
98 | 99 | ## About Owner 100 | 101 |
Tap On Me For See Details Of Owner 102 | 103 | - YouTube Channel : [Tech VJ](https://youtube.com/@Tech_VJ) 104 | - Telegram Channel : [VJ Botz](https://telegram.me/VJ_Botz) 105 | - Contact Link : [King VJ](https://telegram.me/Kingvj01) 106 | - Instagram Id Link : [Tech VJ](https://instagram.com/tech.vj) 107 | 108 | 109 |
110 | 111 | 112 | ### Copyright ©️ [Tech VJ](https://telegram.me/Kingvj01) 113 | 114 | Selling This Repo Or Code Of This Repo For Money Is Strictly Prohibited 🚫 115 | 116 | -------------------------------------------------------------------------------- /Script.py: -------------------------------------------------------------------------------- 1 | # Don't Remove Credit Tg - @VJ_Botz 2 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 3 | # Ask Doubt on telegram @KingVJ01 4 | 5 | 6 | class script(object): 7 | START_TXT = """ʜᴇʟʟᴏ {}, ᴍʏ ɴᴀᴍᴇ {} 👋, ɪ ᴀᴍ ʟᴀᴛᴇꜱᴛ ᴀᴅᴠᴀɴᴄᴇᴅ ᴀɴᴅ ᴘᴏᴡᴇʀꜰᴜʟ ꜰɪʟᴇ ꜱᴛᴏʀᴇ ʙᴏᴛ + ᴄʟᴏɴᴇ ғᴇᴀᴛᴜʀᴇ + sᴛʀᴇᴀᴍ / ᴅᴏᴡɴʟᴏᴀᴅ ʟɪɴᴋ ғᴇᴀᴛᴜʀᴇ + ᴄᴜꜱᴛᴏᴍ ᴜʀʟ ꜱʜᴏʀᴛɴᴇʀ ꜱᴜᴘᴘᴏʀᴛ + ᴀᴜᴛᴏ ᴅᴇʟᴇᴛᴇ sᴜᴘᴘᴏʀᴛ ᴀɴᴅ ʙᴇꜱᴛ ᴜɪ ᴘᴇʀꜰᴏʀᴍᴀɴᴄᴇ """ 8 | 9 | # Don't Remove Credit Tg - @VJ_Botz 10 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 11 | # Ask Doubt on telegram @KingVJ01 12 | 13 | 14 | CAPTION = """📂 ғɪʟᴇɴᴀᴍᴇ : {file_name} 15 | 16 | ⚙️ sɪᴢᴇ : {file_size} 17 | 18 | Jᴏɪɴ [ᴜᴘᴅᴀᴛᴇ ᴄʜᴀɴɴᴇʟ](https://t.me/vj_botz)""" 19 | 20 | # Don't Remove Credit Tg - @VJ_Botz 21 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 22 | # Ask Doubt on telegram @KingVJ01 23 | 24 | SHORTENER_API_MESSAGE = """Tᴏ ᴀᴅᴅ ᴏʀ ᴜᴘᴅᴀᴛᴇ ʏᴏᴜʀ Sʜᴏʀᴛɴᴇʀ Wᴇʙsɪᴛᴇ API, /api (ᴀᴘɪ) 25 | 26 | Ex: /api 𝟼LZǫ𝟾𝟻𝟷sXᴏғғғPHᴜɢɪKQǫ 27 | 28 | Cᴜʀʀᴇɴᴛ Wᴇʙsɪᴛᴇ: {base_site} 29 | 30 | Cᴜʀʀᴇɴᴛ Sʜᴏʀᴛᴇɴᴇʀ API: `{shortener_api}` 31 | 32 | If You Want To Remove Api Then Copy This And Send To Bot - `/api None`""" 33 | 34 | # Don't Remove Credit Tg - @VJ_Botz 35 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 36 | # Ask Doubt on telegram @KingVJ01 37 | 38 | CLONE_START_TXT = """ʜᴇʟʟᴏ {}, ᴍʏ ɴᴀᴍᴇ {} 👋, ɪ ᴀᴍ ʟᴀᴛᴇꜱᴛ ᴀᴅᴠᴀɴᴄᴇᴅ ᴀɴᴅ ᴘᴏᴡᴇʀꜰᴜʟ ꜰɪʟᴇ ꜱᴛᴏʀᴇ ʙᴏᴛ + ᴄᴜꜱᴛᴏᴍ ᴜʀʟ ꜱʜᴏʀᴛɴᴇʀ ꜱᴜᴘᴘᴏʀᴛ ᴀᴜᴛᴏ ᴅᴇʟᴇᴛᴇ sᴜᴘᴘᴏʀᴛ ᴀɴᴅ ʙᴇꜱᴛ ᴜɪ ᴘᴇʀꜰᴏʀᴍᴀɴᴄᴇ 39 | 40 | ɪғ ʏᴏᴜ ᴡᴀɴᴛ ᴛʜɪs ғᴇᴀᴛᴜʀᴇ ᴛʜᴇɴ ᴄʀᴇᴀᴛᴇ ʏᴏᴜʀ ᴏᴡɴ ᴄʟᴏɴᴇ ʙᴏᴛ ғʀᴏᴍ ᴍʏ ᴘᴀʀᴇɴᴛ""" 41 | 42 | # Don't Remove Credit Tg - @VJ_Botz 43 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 44 | # Ask Doubt on telegram @KingVJ01 45 | 46 | ABOUT_TXT = """ʜɪ ɪ ᴀᴍ ᴘᴇʀᴍᴀɴᴇɴᴛ ғɪʟᴇ sᴛᴏʀᴇ ʙᴏᴛ ᴡɪᴛʜ ᴄʟᴏɴᴇ ғᴇᴀᴛᴜʀᴇ + ᴄᴜsᴛᴏᴍ ᴜʀʟ sʜᴏʀᴛɴᴇʀ ɪᴛ ᴍᴇᴀɴs ᴀɴʏ ᴜsᴇʀ ᴄᴀɴ sᴇᴛ ʜɪs ᴜʀʟ sʜᴏʀᴛɴᴇʀ ᴀɴᴅ + ᴀᴜᴛᴏ ᴅᴇʟᴇᴛᴇ. 47 | 48 | 🤖 ᴍʏ ɴᴀᴍᴇ: {} 49 | 50 | 📝 ʟᴀɴɢᴜᴀɢᴇ: 𝐏𝐲𝐭𝐡𝐨𝐧𝟑 51 | 52 | 📚 ʟɪʙʀᴀʀʏ: 𝐏𝐲𝐫𝐨𝐠𝐫𝐚𝐦 53 | 54 | 🧑🏻‍💻 ᴅᴇᴠᴇʟᴏᴘᴇʀ: 𝐓𝐞𝐜𝐡 𝐕𝐉 55 | 56 | 👥 sᴜᴘᴘᴏʀᴛ ɢʀᴏᴜᴘ: 𝐕𝐉 𝐒𝐮𝐩𝐩𝐨𝐫𝐭 57 | 58 | 📢 ᴜᴘᴅᴀᴛᴇ ᴄʜᴀɴɴᴇʟ: 𝐕𝐉 𝐔𝐩𝐝𝐚𝐭𝐞 59 | """ 60 | 61 | CABOUT_TXT = """ʜɪ ɪ ᴀᴍ ᴘᴇʀᴍᴀɴᴇɴᴛ ғɪʟᴇ sᴛᴏʀᴇ ʙᴏᴛ ᴡɪᴛʜ ᴄʟᴏɴᴇ ғᴇᴀᴛᴜʀᴇ + ᴄᴜsᴛᴏᴍ ᴜʀʟ sʜᴏʀᴛɴᴇʀ ɪᴛ ᴍᴇᴀɴs ᴀɴʏ ᴜsᴇʀ ᴄᴀɴ sᴇᴛ ʜɪs ᴜʀʟ sʜᴏʀᴛɴᴇʀ ᴀɴᴅ + ᴀᴜᴛᴏ ᴅᴇʟᴇᴛᴇ. 62 | 63 | 🤖 ᴍʏ ɴᴀᴍᴇ: {} 64 | 65 | 📝 ʟᴀɴɢᴜᴀɢᴇ: 𝐏𝐲𝐭𝐡𝐨𝐧𝟑 66 | 67 | 📚 ʟɪʙʀᴀʀʏ: 𝐏𝐲𝐫𝐨𝐠𝐫𝐚𝐦 68 | 69 | 🧑🏻‍💻 ᴅᴇᴠᴇʟᴏᴘᴇʀ: ᴅᴇᴠᴇʟᴏᴘᴇʀ 70 | """ 71 | 72 | # Don't Remove Credit Tg - @VJ_Botz 73 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 74 | # Ask Doubt on telegram @KingVJ01 75 | 76 | CLONE_TXT = """ʜᴇʟʟᴏ {} 👋 77 | 78 | First Send /clone command then follow below steps. 79 | 80 | 1) sᴇɴᴅ /newbot ᴛᴏ @BotFather 81 | 2) ɢɪᴠᴇ ᴀ ɴᴀᴍᴇ ꜰᴏʀ ʏᴏᴜʀ ʙᴏᴛ. 82 | 3) ɢɪᴠᴇ ᴀ ᴜɴɪǫᴜᴇ ᴜsᴇʀɴᴀᴍᴇ. 83 | 4) ᴛʜᴇɴ ʏᴏᴜ ᴡɪʟʟ ɢᴇᴛ ᴀ ᴍᴇssᴀɢᴇ ᴡɪᴛʜ ʏᴏᴜʀ ʙᴏᴛ ᴛᴏᴋᴇɴ. 84 | 5) ꜰᴏʀᴡᴀʀᴅ ᴛʜᴀᴛ ᴍᴇssᴀɢᴇ ᴛᴏ ᴍᴇ. 85 | 86 | ᴛʜᴇɴ ɪ ᴀᴍ ᴛʀʏ ᴛᴏ ᴄʀᴇᴀᴛᴇ ᴀ ᴄᴏᴘʏ ʙᴏᴛ ᴏғ ᴍᴇ ғᴏʀ ʏᴏᴜ ᴏɴʟʏ 😌""" 87 | 88 | # Don't Remove Credit Tg - @VJ_Botz 89 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 90 | # Ask Doubt on telegram @KingVJ01 91 | 92 | HELP_TXT = """💢 HOW TO USE THE BOT ☺️ 93 | 94 | 🔻 /link - ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴠɪᴅᴇᴏ ᴏʀ ғɪʟᴇ ᴛᴏ ɢᴇᴛ sʜᴀʀᴀʙʟᴇ ʟɪɴᴋ 95 | 96 | 🔻 /batch - sᴇɴᴅ ғɪʀsᴛ ʟɪɴᴋ ᴏғ ғɪʟᴇ sᴛᴏʀᴇ ᴄʜᴀɴɴᴇʟ ᴘᴏsᴛ ᴛʜᴇɴ ʟᴀsᴛ ᴘᴏsᴛ ʟɪɴᴋ ᴀɴᴅ ᴍᴀᴋᴇ sᴜʀᴇ ʙᴏᴛ ɪs ᴀᴅᴍɪɴ ɪɴ ʏᴏᴜʀ ғɪʟᴇ sᴛᴏʀᴇ ᴄʜᴀɴɴᴇʟ. 97 | ᴇx - /batch https://t.me/vj_botz/25 https://t.me/vj_botz/30 98 | 99 | 🔻 /clone - ᴄʀᴇᴀᴛᴇ ʏᴏᴜʀ ᴏᴡɴ ɪᴅᴇɴᴛɪᴄᴀʟ ᴄʟᴏɴᴇ ʙᴏᴛ 100 | 101 | 🔻 /base_site - ᴜsᴇ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ sᴇᴛ ᴜʀʟ sʜᴏʀᴛɴᴇʀ ʟɪɴᴋ ᴅᴏᴍᴀɪɴ 102 | ᴇx - /base_site ʏᴏᴜʀᴅᴏᴍᴀɪɴ.ᴄᴏᴍ 103 | 104 | 🔻 /api - sᴇᴛ ʏᴏᴜʀ ᴜʀʟ sʜᴏʀᴛɴᴇʀ ᴀᴄᴄᴏᴜɴᴛ ᴀᴘɪ 105 | ᴇx - /api ʙᴀᴏᴡɢᴡᴋʟᴀᴀʙᴀᴋʟ 106 | 107 | 🔻 /deletecloned - ᴜsᴇ ᴛʜɪs ғᴏʀ ᴅᴇʟᴇᴛᴇ ʏᴏᴜʀ ᴄʟᴏɴᴇ ʙᴏᴛ 108 | 109 | 🔻 /broadcast - ʀᴇᴘʟʏ ᴛᴏ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ ᴀ ᴍᴇssᴀɢᴇ ᴛᴏ ʙʀᴏᴀᴅᴄᴀsᴛ (ʙᴏᴛ ᴏᴡɴᴇʀ ᴏɴʟʏ)""" 110 | 111 | # Don't Remove Credit Tg - @VJ_Botz 112 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 113 | # Ask Doubt on telegram @KingVJ01 114 | 115 | 116 | CHELP_TXT = """💢 Hᴏᴡ Tᴏ Usᴇ Tʜɪs Bᴏᴛ ☺️ 117 | 118 | 🔻 /link - ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴠɪᴅᴇᴏ ᴏʀ ғɪʟᴇ ᴛᴏ ɢᴇᴛ sʜᴀʀᴀʙʟᴇ ʟɪɴᴋ 119 | 120 | 🔻 /base_site - ᴜsᴇ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ sᴇᴛ ᴜʀʟ sʜᴏʀᴛɴᴇʀ ʟɪɴᴋ ᴅᴏᴍᴀɪɴ 121 | ᴇx - /base_site ʏᴏᴜʀᴅᴏᴍᴀɪɴ.ᴄᴏᴍ 122 | 123 | 🔻 /api - sᴇᴛ ʏᴏᴜʀ ᴜʀʟ sʜᴏʀᴛɴᴇʀ ᴀᴄᴄᴏᴜɴᴛ ᴀᴘɪ 124 | ᴇx - /api ʙᴀᴏᴡɢᴡᴋʟᴀᴀʙᴀᴋʟ 125 | 126 | 🔻 /broadcast - ʀᴇᴘʟʏ ᴛᴏ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ ᴀ ᴍᴇssᴀɢᴇ ᴛᴏ ʙʀᴏᴀᴅᴄᴀsᴛ (ʙᴏᴛ ᴏᴡɴᴇʀ ᴏɴʟʏ)""" 127 | 128 | # Don't Remove Credit Tg - @VJ_Botz 129 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 130 | # Ask Doubt on telegram @KingVJ01 131 | 132 | LOG_TEXT = """#NewUser 133 | 134 | ID - {} 135 | 136 | Nᴀᴍᴇ - {} 137 | """ 138 | RESTART_TXT = """ 139 | Bᴏᴛ Rᴇsᴛᴀʀᴛᴇᴅ ! 140 | 141 | 📅 Dᴀᴛᴇ : {} 142 | ⏰ Tɪᴍᴇ : {} 143 | 🌐 Tɪᴍᴇᴢᴏɴᴇ : Asia/Kolkata 144 | 🛠️ Bᴜɪʟᴅ Sᴛᴀᴛᴜs: v2.7.1 [ Sᴛᴀʙʟᴇ ]""" 145 | 146 | # Don't Remove Credit Tg - @VJ_Botz 147 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 148 | # Ask Doubt on telegram @KingVJ01 149 | -------------------------------------------------------------------------------- /TechVJ/__init__.py: -------------------------------------------------------------------------------- 1 | import time 2 | StartTime = time.time() 3 | __version__ = 1.1 4 | -------------------------------------------------------------------------------- /TechVJ/bot/TechVJ: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /TechVJ/bot/__init__.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, types 2 | from config import * 3 | from typing import Union, Optional, AsyncGenerator 4 | from aiohttp import web 5 | 6 | class StreamXBot(Client): 7 | 8 | def __init__(self): 9 | super().__init__( 10 | name="vjfiletolink", 11 | api_id=API_ID, 12 | api_hash=API_HASH, 13 | bot_token=BOT_TOKEN, 14 | workers=50, 15 | plugins={"root": "plugins"}, 16 | sleep_threshold=5, 17 | ) 18 | async def iter_messages( 19 | self, 20 | chat_id: Union[int, str], 21 | limit: int, 22 | offset: int = 0, 23 | ) -> Optional[AsyncGenerator["types.Message", None]]: 24 | """Iterate through a chat sequentially. 25 | This convenience method does the same as repeatedly calling :meth:`~pyrogram.Client.get_messages` in a loop, thus saving 26 | you from the hassle of setting up boilerplate code. It is useful for getting the whole chat messages with a 27 | single call. 28 | Parameters: 29 | chat_id (``int`` | ``str``): 30 | Unique identifier (int) or username (str) of the target chat. 31 | For your personal cloud (Saved Messages) you can simply use "me" or "self". 32 | For a contact that exists in your Telegram address book you can use his phone number (str). 33 | 34 | limit (``int``): 35 | Identifier of the last message to be returned. 36 | 37 | offset (``int``, *optional*): 38 | Identifier of the first message to be returned. 39 | Defaults to 0. 40 | Returns: 41 | ``Generator``: A generator yielding :obj:`~pyrogram.types.Message` objects. 42 | Example: 43 | .. code-block:: python 44 | for message in app.iter_messages("pyrogram", 1, 15000): 45 | print(message.text) 46 | """ 47 | current = offset 48 | while True: 49 | new_diff = min(200, limit - current) 50 | if new_diff <= 0: 51 | return 52 | messages = await self.get_messages(chat_id, list(range(current, current+new_diff+1))) 53 | for message in messages: 54 | yield message 55 | current += 1 56 | 57 | StreamBot = StreamXBot() 58 | 59 | multi_clients = {} 60 | work_loads = {} 61 | -------------------------------------------------------------------------------- /TechVJ/bot/clients.py: -------------------------------------------------------------------------------- 1 | # (c) adarsh-goel 2 | 3 | import asyncio 4 | import logging 5 | from config import API_HASH, API_ID, MULTI_CLIENT, SLEEP_THRESHOLD 6 | from pyrogram import Client 7 | from TechVJ.utils.config_parser import TokenParser 8 | from . import multi_clients, work_loads, StreamBot 9 | 10 | 11 | async def initialize_clients(): 12 | multi_clients[0] = StreamBot 13 | work_loads[0] = 0 14 | all_tokens = TokenParser().parse_from_env() 15 | if not all_tokens: 16 | print("No additional clients found, using default client") 17 | return 18 | 19 | async def start_client(client_id, token): 20 | try: 21 | print(f"Starting - Client {client_id}") 22 | if client_id == len(all_tokens): 23 | await asyncio.sleep(2) 24 | print("This will take some time, please wait...") 25 | client = await Client( 26 | name=str(client_id), 27 | api_id=API_ID, 28 | api_hash=API_HASH, 29 | bot_token=token, 30 | sleep_threshold=SLEEP_THRESHOLD, 31 | no_updates=True, 32 | in_memory=True 33 | ).start() 34 | work_loads[client_id] = 0 35 | return client_id, client 36 | except Exception: 37 | logging.error(f"Failed starting Client - {client_id} Error:", exc_info=True) 38 | 39 | clients = await asyncio.gather(*[start_client(i, token) for i, token in all_tokens.items()]) 40 | multi_clients.update(dict(clients)) 41 | if len(multi_clients) != 1: 42 | MULTI_CLIENT = True 43 | print("Multi-Client Mode Enabled") 44 | else: 45 | print("No additional clients were initialized, using default client") 46 | -------------------------------------------------------------------------------- /TechVJ/server/TechVJ: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /TechVJ/server/__init__.py: -------------------------------------------------------------------------------- 1 | from aiohttp import web 2 | from .stream_routes import routes 3 | 4 | 5 | async def web_server(): 6 | web_app = web.Application(client_max_size=30000000) 7 | web_app.add_routes(routes) 8 | return web_app 9 | -------------------------------------------------------------------------------- /TechVJ/server/exceptions.py: -------------------------------------------------------------------------------- 1 | 2 | class InvalidHash(Exception): 3 | message = "Invalid hash" 4 | 5 | class FIleNotFound(Exception): 6 | message = "File not found" -------------------------------------------------------------------------------- /TechVJ/server/stream_routes.py: -------------------------------------------------------------------------------- 1 | import re 2 | import time 3 | import math 4 | import logging 5 | import secrets 6 | import mimetypes 7 | from aiohttp import web 8 | from aiohttp.http_exceptions import BadStatusLine 9 | from TechVJ.bot import multi_clients, work_loads, StreamBot 10 | from TechVJ.server.exceptions import FIleNotFound, InvalidHash 11 | from TechVJ import StartTime, __version__ 12 | from ..utils.time_format import get_readable_time 13 | from ..utils.custom_dl import ByteStreamer 14 | from TechVJ.utils.render_template import render_page 15 | from config import MULTI_CLIENT 16 | 17 | 18 | routes = web.RouteTableDef() 19 | 20 | @routes.get("/", allow_head=True) 21 | async def root_route_handler(_): 22 | return web.json_response( 23 | { 24 | "server_status": "running", 25 | "uptime": get_readable_time(time.time() - StartTime), 26 | "telegram_bot": "@" + StreamBot.username, 27 | "connected_bots": len(multi_clients), 28 | "loads": dict( 29 | ("bot" + str(c + 1), l) 30 | for c, (_, l) in enumerate( 31 | sorted(work_loads.items(), key=lambda x: x[1], reverse=True) 32 | ) 33 | ), 34 | "version": __version__, 35 | } 36 | ) 37 | 38 | 39 | @routes.get(r"/watch/{path:\S+}", allow_head=True) 40 | async def stream_handler(request: web.Request): 41 | try: 42 | path = request.match_info["path"] 43 | match = re.search(r"^([a-zA-Z0-9_-]{6})(\d+)$", path) 44 | if match: 45 | secure_hash = match.group(1) 46 | id = int(match.group(2)) 47 | else: 48 | id = int(re.search(r"(\d+)(?:\/\S+)?", path).group(1)) 49 | secure_hash = request.rel_url.query.get("hash") 50 | return web.Response(text=await render_page(id, secure_hash), content_type='text/html') 51 | except InvalidHash as e: 52 | raise web.HTTPForbidden(text=e.message) 53 | except FIleNotFound as e: 54 | raise web.HTTPNotFound(text=e.message) 55 | except (AttributeError, BadStatusLine, ConnectionResetError): 56 | pass 57 | except Exception as e: 58 | logging.critical(e.with_traceback(None)) 59 | raise web.HTTPInternalServerError(text=str(e)) 60 | 61 | @routes.get(r"/{path:\S+}", allow_head=True) 62 | async def stream_handler(request: web.Request): 63 | try: 64 | path = request.match_info["path"] 65 | match = re.search(r"^([a-zA-Z0-9_-]{6})(\d+)$", path) 66 | if match: 67 | secure_hash = match.group(1) 68 | id = int(match.group(2)) 69 | else: 70 | id = int(re.search(r"(\d+)(?:\/\S+)?", path).group(1)) 71 | secure_hash = request.rel_url.query.get("hash") 72 | return await media_streamer(request, id, secure_hash) 73 | except InvalidHash as e: 74 | raise web.HTTPForbidden(text=e.message) 75 | except FIleNotFound as e: 76 | raise web.HTTPNotFound(text=e.message) 77 | except (AttributeError, BadStatusLine, ConnectionResetError): 78 | pass 79 | except Exception as e: 80 | logging.critical(e.with_traceback(None)) 81 | raise web.HTTPInternalServerError(text=str(e)) 82 | 83 | class_cache = {} 84 | 85 | async def media_streamer(request: web.Request, id: int, secure_hash: str): 86 | range_header = request.headers.get("Range", 0) 87 | 88 | index = min(work_loads, key=work_loads.get) 89 | faster_client = multi_clients[index] 90 | 91 | if MULTI_CLIENT: 92 | logging.info(f"Client {index} is now serving {request.remote}") 93 | 94 | if faster_client in class_cache: 95 | tg_connect = class_cache[faster_client] 96 | logging.debug(f"Using cached ByteStreamer object for client {index}") 97 | else: 98 | logging.debug(f"Creating new ByteStreamer object for client {index}") 99 | tg_connect = ByteStreamer(faster_client) 100 | class_cache[faster_client] = tg_connect 101 | logging.debug("before calling get_file_properties") 102 | file_id = await tg_connect.get_file_properties(id) 103 | logging.debug("after calling get_file_properties") 104 | 105 | if file_id.unique_id[:6] != secure_hash: 106 | logging.debug(f"Invalid hash for message with ID {id}") 107 | raise InvalidHash 108 | 109 | file_size = file_id.file_size 110 | 111 | if range_header: 112 | from_bytes, until_bytes = range_header.replace("bytes=", "").split("-") 113 | from_bytes = int(from_bytes) 114 | until_bytes = int(until_bytes) if until_bytes else file_size - 1 115 | else: 116 | from_bytes = request.http_range.start or 0 117 | until_bytes = (request.http_range.stop or file_size) - 1 118 | 119 | if (until_bytes > file_size) or (from_bytes < 0) or (until_bytes < from_bytes): 120 | return web.Response( 121 | status=416, 122 | body="416: Range not satisfiable", 123 | headers={"Content-Range": f"bytes */{file_size}"}, 124 | ) 125 | 126 | chunk_size = 1024 * 1024 127 | until_bytes = min(until_bytes, file_size - 1) 128 | 129 | offset = from_bytes - (from_bytes % chunk_size) 130 | first_part_cut = from_bytes - offset 131 | last_part_cut = until_bytes % chunk_size + 1 132 | 133 | req_length = until_bytes - from_bytes + 1 134 | part_count = math.ceil(until_bytes / chunk_size) - math.floor(offset / chunk_size) 135 | body = tg_connect.yield_file( 136 | file_id, index, offset, first_part_cut, last_part_cut, part_count, chunk_size 137 | ) 138 | 139 | mime_type = file_id.mime_type 140 | file_name = file_id.file_name 141 | disposition = "attachment" 142 | 143 | if mime_type: 144 | if not file_name: 145 | try: 146 | file_name = f"{secrets.token_hex(2)}.{mime_type.split('/')[1]}" 147 | except (IndexError, AttributeError): 148 | file_name = f"{secrets.token_hex(2)}.unknown" 149 | else: 150 | if file_name: 151 | mime_type = mimetypes.guess_type(file_id.file_name) 152 | else: 153 | mime_type = "application/octet-stream" 154 | file_name = f"{secrets.token_hex(2)}.unknown" 155 | 156 | return web.Response( 157 | status=206 if range_header else 200, 158 | body=body, 159 | headers={ 160 | "Content-Type": f"{mime_type}", 161 | "Content-Range": f"bytes {from_bytes}-{until_bytes}/{file_size}", 162 | "Content-Length": str(req_length), 163 | "Content-Disposition": f'{disposition}; filename="{file_name}"', 164 | "Accept-Ranges": "bytes", 165 | }, 166 | ) 167 | -------------------------------------------------------------------------------- /TechVJ/template/TechVJ: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /TechVJ/template/dl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | %s | Tech VJ 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 133 | 134 |
135 |
136 | 137 |
138 |
139 |

140 | 141 | %s 142 | 143 |

144 |
145 |
146 |
147 | 148 | 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 | 205 |
206 |
207 | 210 |
211 |
212 | 220 |
221 | 222 | 223 |
224 |
225 |
226 |
227 | 228 |
229 |
230 |
231 |
232 |
233 |
234 | 235 | © Copyright : 239 | Tech VJ 240 | 241 | All right reserved 242 |
243 |
244 | 245 | 246 | 270 | 271 | 274 | 283 | 284 | 285 | 286 | 287 | -------------------------------------------------------------------------------- /TechVJ/template/req.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{file_name}} | Tech VJ 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 132 | 133 |
134 | 135 | 136 |
137 | 138 |
139 |
140 |

141 | 142 | {{file_name}} 143 | 144 |

145 |
146 |
147 | 148 |
149 |
150 | 153 |
154 |
155 | 156 | 157 |
158 |
159 | 160 |
161 |

Play with...

162 |
163 |
164 |
165 | 166 | VLC Player 167 |
168 |
169 | 170 | Mx Player 171 |
172 |
173 | 174 | Play-it 175 |
176 |
177 | 178 | km Player 179 |
180 |
181 | 182 | 183 | 184 | S Player 185 |
186 | 187 |
188 | 189 | 190 | 191 | 192 | HD Player(4K) 193 |
194 |
195 | Download Now 196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 | Video not playing ? possibly because your browser or the player doesn't support codec please download and watch. 204 |
205 |
206 |
207 |
208 |
209 |
210 | If you find any broken links then please contact Tech VJ 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 | 263 |
264 |
265 | 268 |
269 |
270 | 278 |
279 | 280 | 281 |
282 |
283 |
284 |
285 | 286 |
287 |
288 |
289 |
290 |
291 |
292 | 293 | © Copyright : 297 | Tech VJ 298 | 299 | All right reserved 300 |
301 |
302 | 303 | 304 | 305 | 308 | 317 | 318 | 319 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 364 | 365 | 366 | 367 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | -------------------------------------------------------------------------------- /TechVJ/utils/TechVJ: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /TechVJ/utils/config_parser.py: -------------------------------------------------------------------------------- 1 | from os import environ 2 | from typing import Dict, Optional 3 | 4 | 5 | class TokenParser: 6 | def __init__(self, config_file: Optional[str] = None): 7 | self.tokens = {} 8 | self.config_file = config_file 9 | 10 | def parse_from_env(self) -> Dict[int, str]: 11 | self.tokens = dict( 12 | (c + 1, t) 13 | for c, (_, t) in enumerate( 14 | filter( 15 | lambda n: n[0].startswith("MULTI_TOKEN"), sorted(environ.items()) 16 | ) 17 | ) 18 | ) 19 | return self.tokens 20 | -------------------------------------------------------------------------------- /TechVJ/utils/custom_dl.py: -------------------------------------------------------------------------------- 1 | import math 2 | import asyncio 3 | import logging 4 | from config import LOG_CHANNEL 5 | from typing import Dict, Union 6 | from TechVJ.bot import work_loads 7 | from pyrogram import Client, utils, raw 8 | from .file_properties import get_file_ids 9 | from pyrogram.session import Session, Auth 10 | from pyrogram.errors import AuthBytesInvalid 11 | from TechVJ.server.exceptions import FIleNotFound 12 | from pyrogram.file_id import FileId, FileType, ThumbnailSource 13 | 14 | 15 | class ByteStreamer: 16 | def __init__(self, client: Client): 17 | """A custom class that holds the cache of a specific client and class functions. 18 | attributes: 19 | client: the client that the cache is for. 20 | cached_file_ids: a dict of cached file IDs. 21 | cached_file_properties: a dict of cached file properties. 22 | 23 | functions: 24 | generate_file_properties: returns the properties for a media of a specific message contained in Tuple. 25 | generate_media_session: returns the media session for the DC that contains the media file. 26 | yield_file: yield a file from telegram servers for streaming. 27 | 28 | This is a modified version of the 29 | Thanks to Eyaadh 30 | """ 31 | self.clean_timer = 30 * 60 32 | self.client: Client = client 33 | self.cached_file_ids: Dict[int, FileId] = {} 34 | asyncio.create_task(self.clean_cache()) 35 | 36 | async def get_file_properties(self, id: int) -> FileId: 37 | """ 38 | Returns the properties of a media of a specific message in a FIleId class. 39 | if the properties are cached, then it'll return the cached results. 40 | or it'll generate the properties from the Message ID and cache them. 41 | """ 42 | if id not in self.cached_file_ids: 43 | await self.generate_file_properties(id) 44 | logging.debug(f"Cached file properties for message with ID {id}") 45 | return self.cached_file_ids[id] 46 | 47 | async def generate_file_properties(self, id: int) -> FileId: 48 | """ 49 | Generates the properties of a media file on a specific message. 50 | returns ths properties in a FIleId class. 51 | """ 52 | file_id = await get_file_ids(self.client, LOG_CHANNEL, id) 53 | logging.debug(f"Generated file ID and Unique ID for message with ID {id}") 54 | if not file_id: 55 | logging.debug(f"Message with ID {id} not found") 56 | raise FIleNotFound 57 | self.cached_file_ids[id] = file_id 58 | logging.debug(f"Cached media message with ID {id}") 59 | return self.cached_file_ids[id] 60 | 61 | async def generate_media_session(self, client: Client, file_id: FileId) -> Session: 62 | """ 63 | Generates the media session for the DC that contains the media file. 64 | This is required for getting the bytes from Telegram servers. 65 | """ 66 | 67 | media_session = client.media_sessions.get(file_id.dc_id, None) 68 | 69 | if media_session is None: 70 | if file_id.dc_id != await client.storage.dc_id(): 71 | media_session = Session( 72 | client, 73 | file_id.dc_id, 74 | await Auth( 75 | client, file_id.dc_id, await client.storage.test_mode() 76 | ).create(), 77 | await client.storage.test_mode(), 78 | is_media=True, 79 | ) 80 | await media_session.start() 81 | 82 | for _ in range(6): 83 | exported_auth = await client.invoke( 84 | raw.functions.auth.ExportAuthorization(dc_id=file_id.dc_id) 85 | ) 86 | 87 | try: 88 | await media_session.send( 89 | raw.functions.auth.ImportAuthorization( 90 | id=exported_auth.id, bytes=exported_auth.bytes 91 | ) 92 | ) 93 | break 94 | except AuthBytesInvalid: 95 | logging.debug( 96 | f"Invalid authorization bytes for DC {file_id.dc_id}" 97 | ) 98 | continue 99 | else: 100 | await media_session.stop() 101 | raise AuthBytesInvalid 102 | else: 103 | media_session = Session( 104 | client, 105 | file_id.dc_id, 106 | await client.storage.auth_key(), 107 | await client.storage.test_mode(), 108 | is_media=True, 109 | ) 110 | await media_session.start() 111 | logging.debug(f"Created media session for DC {file_id.dc_id}") 112 | client.media_sessions[file_id.dc_id] = media_session 113 | else: 114 | logging.debug(f"Using cached media session for DC {file_id.dc_id}") 115 | return media_session 116 | 117 | 118 | @staticmethod 119 | async def get_location(file_id: FileId) -> Union[raw.types.InputPhotoFileLocation, 120 | raw.types.InputDocumentFileLocation, 121 | raw.types.InputPeerPhotoFileLocation,]: 122 | """ 123 | Returns the file location for the media file. 124 | """ 125 | file_type = file_id.file_type 126 | 127 | if file_type == FileType.CHAT_PHOTO: 128 | if file_id.chat_id > 0: 129 | peer = raw.types.InputPeerUser( 130 | user_id=file_id.chat_id, access_hash=file_id.chat_access_hash 131 | ) 132 | else: 133 | if file_id.chat_access_hash == 0: 134 | peer = raw.types.InputPeerChat(chat_id=-file_id.chat_id) 135 | else: 136 | peer = raw.types.InputPeerChannel( 137 | channel_id=utils.get_channel_id(file_id.chat_id), 138 | access_hash=file_id.chat_access_hash, 139 | ) 140 | 141 | location = raw.types.InputPeerPhotoFileLocation( 142 | peer=peer, 143 | volume_id=file_id.volume_id, 144 | local_id=file_id.local_id, 145 | big=file_id.thumbnail_source == ThumbnailSource.CHAT_PHOTO_BIG, 146 | ) 147 | elif file_type == FileType.PHOTO: 148 | location = raw.types.InputPhotoFileLocation( 149 | id=file_id.media_id, 150 | access_hash=file_id.access_hash, 151 | file_reference=file_id.file_reference, 152 | thumb_size=file_id.thumbnail_size, 153 | ) 154 | else: 155 | location = raw.types.InputDocumentFileLocation( 156 | id=file_id.media_id, 157 | access_hash=file_id.access_hash, 158 | file_reference=file_id.file_reference, 159 | thumb_size=file_id.thumbnail_size, 160 | ) 161 | return location 162 | 163 | async def yield_file( 164 | self, 165 | file_id: FileId, 166 | index: int, 167 | offset: int, 168 | first_part_cut: int, 169 | last_part_cut: int, 170 | part_count: int, 171 | chunk_size: int, 172 | ) -> Union[str, None]: 173 | """ 174 | Custom generator that yields the bytes of the media file. 175 | Modded from 176 | Thanks to Eyaadh 177 | """ 178 | client = self.client 179 | work_loads[index] += 1 180 | logging.debug(f"Starting to yielding file with client {index}.") 181 | media_session = await self.generate_media_session(client, file_id) 182 | 183 | current_part = 1 184 | location = await self.get_location(file_id) 185 | 186 | try: 187 | r = await media_session.send( 188 | raw.functions.upload.GetFile( 189 | location=location, offset=offset, limit=chunk_size 190 | ), 191 | ) 192 | if isinstance(r, raw.types.upload.File): 193 | while True: 194 | chunk = r.bytes 195 | if not chunk: 196 | break 197 | elif part_count == 1: 198 | yield chunk[first_part_cut:last_part_cut] 199 | elif current_part == 1: 200 | yield chunk[first_part_cut:] 201 | elif current_part == part_count: 202 | yield chunk[:last_part_cut] 203 | else: 204 | yield chunk 205 | 206 | current_part += 1 207 | offset += chunk_size 208 | 209 | if current_part > part_count: 210 | break 211 | 212 | r = await media_session.send( 213 | raw.functions.upload.GetFile( 214 | location=location, offset=offset, limit=chunk_size 215 | ), 216 | ) 217 | except (TimeoutError, AttributeError): 218 | pass 219 | finally: 220 | logging.debug("Finished yielding file with {current_part} parts.") 221 | work_loads[index] -= 1 222 | 223 | 224 | async def clean_cache(self) -> None: 225 | """ 226 | function to clean the cache to reduce memory usage 227 | """ 228 | while True: 229 | await asyncio.sleep(self.clean_timer) 230 | self.cached_file_ids.clear() 231 | logging.debug("Cleaned the cache") 232 | -------------------------------------------------------------------------------- /TechVJ/utils/file_properties.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client 2 | from typing import Any, Optional 3 | from pyrogram.types import Message 4 | from pyrogram.file_id import FileId 5 | from pyrogram.raw.types.messages import Messages 6 | from TechVJ.server.exceptions import FIleNotFound 7 | 8 | 9 | async def parse_file_id(message: "Message") -> Optional[FileId]: 10 | media = get_media_from_message(message) 11 | if media: 12 | return FileId.decode(media.file_id) 13 | 14 | async def parse_file_unique_id(message: "Messages") -> Optional[str]: 15 | media = get_media_from_message(message) 16 | if media: 17 | return media.file_unique_id 18 | 19 | async def get_file_ids(client: Client, chat_id: int, id: int) -> Optional[FileId]: 20 | message = await client.get_messages(chat_id, id) 21 | if message.empty: 22 | raise FIleNotFound 23 | media = get_media_from_message(message) 24 | file_unique_id = await parse_file_unique_id(message) 25 | file_id = await parse_file_id(message) 26 | setattr(file_id, "file_size", getattr(media, "file_size", 0)) 27 | setattr(file_id, "mime_type", getattr(media, "mime_type", "")) 28 | setattr(file_id, "file_name", getattr(media, "file_name", "")) 29 | setattr(file_id, "unique_id", file_unique_id) 30 | return file_id 31 | 32 | def get_media_from_message(message: "Message") -> Any: 33 | media_types = ( 34 | "audio", 35 | "document", 36 | "photo", 37 | "sticker", 38 | "animation", 39 | "video", 40 | "voice", 41 | "video_note", 42 | ) 43 | for attr in media_types: 44 | media = getattr(message, attr, None) 45 | if media: 46 | return media 47 | 48 | 49 | def get_hash(media_msg: Message) -> str: 50 | media = get_media_from_message(media_msg) 51 | return getattr(media, "file_unique_id", "")[:6] 52 | 53 | def get_name(media_msg: Message) -> str: 54 | media = get_media_from_message(media_msg) 55 | return getattr(media, 'file_name', "") 56 | 57 | def get_media_file_size(m): 58 | media = get_media_from_message(m) 59 | return getattr(media, "file_size", 0) 60 | -------------------------------------------------------------------------------- /TechVJ/utils/file_size.py: -------------------------------------------------------------------------------- 1 | def human_size(bytes, units=[' bytes','KB','MB','GB','TB', 'PB', 'EB']): 2 | """ Returns a human readable string representation of bytes """ 3 | return str(bytes) + units[0] if int(bytes) < 1024 else human_size(int(bytes)>>10, units[1:]) 4 | -------------------------------------------------------------------------------- /TechVJ/utils/human_readable.py: -------------------------------------------------------------------------------- 1 | def humanbytes(size): 2 | # https://stackoverflow.com/a/49361727/4723940 3 | # 2**10 = 1024 4 | if not size: 5 | return "" 6 | power = 2**10 7 | n = 0 8 | Dic_powerN = {0: ' ', 1: 'Ki', 2: 'Mi', 3: 'Gi', 4: 'Ti'} 9 | while size > power: 10 | size /= power 11 | n += 1 12 | return str(round(size, 2)) + " " + Dic_powerN[n] + 'B' 13 | -------------------------------------------------------------------------------- /TechVJ/utils/keepalive.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import logging 3 | import aiohttp 4 | import traceback 5 | from config import PING_INTERVAL 6 | 7 | 8 | async def ping_server(): 9 | sleep_time = PING_INTERVAL 10 | while True: 11 | await asyncio.sleep(sleep_time) 12 | try: 13 | async with aiohttp.ClientSession( 14 | timeout=aiohttp.ClientTimeout(total=10) 15 | ) as session: 16 | async with session.get(Var.URL) as resp: 17 | logging.info("Pinged server with response: {}".format(resp.status)) 18 | except TimeoutError: 19 | logging.warning("Couldn't connect to the site URL..!") 20 | except Exception: 21 | traceback.print_exc() 22 | -------------------------------------------------------------------------------- /TechVJ/utils/render_template.py: -------------------------------------------------------------------------------- 1 | import jinja2 2 | from config import LOG_CHANNEL, URL 3 | from TechVJ.bot import StreamBot 4 | from TechVJ.utils.human_readable import humanbytes 5 | from TechVJ.utils.file_properties import get_file_ids 6 | from TechVJ.server.exceptions import InvalidHash 7 | import urllib.parse 8 | import logging 9 | import aiohttp 10 | 11 | 12 | async def render_page(id, secure_hash, src=None): 13 | file = await StreamBot.get_messages(int(LOG_CHANNEL), int(id)) 14 | file_data = await get_file_ids(StreamBot, int(LOG_CHANNEL), int(id)) 15 | if file_data.unique_id[:6] != secure_hash: 16 | logging.debug(f"link hash: {secure_hash} - {file_data.unique_id[:6]}") 17 | logging.debug(f"Invalid hash for message with - ID {id}") 18 | raise InvalidHash 19 | 20 | src = urllib.parse.urljoin( 21 | URL, 22 | f"{id}/{urllib.parse.quote_plus(file_data.file_name)}?hash={secure_hash}", 23 | ) 24 | 25 | tag = file_data.mime_type.split("/")[0].strip() 26 | file_size = humanbytes(file_data.file_size) 27 | if tag in ["video", "audio"]: 28 | template_file = "TechVJ/template/req.html" 29 | else: 30 | template_file = "TechVJ/template/dl.html" 31 | async with aiohttp.ClientSession() as s: 32 | async with s.get(src) as u: 33 | file_size = humanbytes(int(u.headers.get("Content-Length"))) 34 | 35 | with open(template_file) as f: 36 | template = jinja2.Template(f.read()) 37 | 38 | file_name = file_data.file_name.replace("_", " ") 39 | 40 | return template.render( 41 | file_name=file_name, 42 | file_url=src, 43 | file_size=file_size, 44 | file_unique_id=file_data.unique_id, 45 | ) 46 | return html 47 | -------------------------------------------------------------------------------- /TechVJ/utils/time_format.py: -------------------------------------------------------------------------------- 1 | def get_readable_time(seconds: int) -> str: 2 | count = 0 3 | readable_time = "" 4 | time_list = [] 5 | time_suffix_list = ["s", "m", "h", " days"] 6 | while count < 4: 7 | count += 1 8 | if count < 3: 9 | remainder, result = divmod(seconds, 60) 10 | else: 11 | remainder, result = divmod(seconds, 24) 12 | if seconds == 0 and remainder == 0: 13 | break 14 | time_list.append(int(result)) 15 | seconds = int(remainder) 16 | for x in range(len(time_list)): 17 | time_list[x] = str(time_list[x]) + time_suffix_list[x] 18 | if len(time_list) == 4: 19 | readable_time += time_list.pop() + ", " 20 | time_list.reverse() 21 | readable_time += ": ".join(time_list) 22 | return readable_time 23 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | app = Flask(__name__) 3 | 4 | @app.route('/') 5 | def hello_world(): 6 | return 'TechVJ' 7 | 8 | 9 | if __name__ == "__main__": 10 | app.run() 11 | 12 | -------------------------------------------------------------------------------- /bot.py: -------------------------------------------------------------------------------- 1 | # Don't Remove Credit @VJ_Botz 2 | # Subscribe YouTube Channel For Amazing Bot @Tech_VJ 3 | # Ask Doubt on telegram @KingVJ01 4 | 5 | 6 | import sys 7 | import glob 8 | import importlib 9 | from pathlib import Path 10 | from pyrogram import idle 11 | import logging 12 | import logging.config 13 | 14 | # Don't Remove Credit Tg - @VJ_Botz 15 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 16 | # Ask Doubt on telegram @KingVJ01 17 | 18 | # Get logging configurations 19 | logging.config.fileConfig('logging.conf') 20 | logging.getLogger().setLevel(logging.INFO) 21 | logging.getLogger("pyrogram").setLevel(logging.ERROR) 22 | 23 | # Don't Remove Credit Tg - @VJ_Botz 24 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 25 | # Ask Doubt on telegram @KingVJ01 26 | 27 | 28 | from pyrogram import Client, __version__ 29 | from pyrogram.raw.all import layer 30 | from config import LOG_CHANNEL, ON_HEROKU, CLONE_MODE, PORT 31 | from typing import Union, Optional, AsyncGenerator 32 | from pyrogram import types 33 | from Script import script 34 | from datetime import date, datetime 35 | import pytz 36 | from aiohttp import web 37 | from TechVJ.server import web_server 38 | 39 | # Don't Remove Credit Tg - @VJ_Botz 40 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 41 | # Ask Doubt on telegram @KingVJ01 42 | 43 | import asyncio 44 | from pyrogram import idle 45 | from plugins.clone import restart_bots 46 | from TechVJ.bot import StreamBot 47 | from TechVJ.utils.keepalive import ping_server 48 | from TechVJ.bot.clients import initialize_clients 49 | 50 | # Don't Remove Credit Tg - @VJ_Botz 51 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 52 | # Ask Doubt on telegram @KingVJ01 53 | 54 | 55 | ppath = "plugins/*.py" 56 | files = glob.glob(ppath) 57 | StreamBot.start() 58 | loop = asyncio.get_event_loop() 59 | 60 | # Don't Remove Credit Tg - @VJ_Botz 61 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 62 | # Ask Doubt on telegram @KingVJ01 63 | 64 | 65 | async def start(): 66 | print('\n') 67 | print('Initalizing Tech VJ Bot') 68 | bot_info = await StreamBot.get_me() 69 | StreamBot.username = bot_info.username 70 | await initialize_clients() 71 | for name in files: 72 | with open(name) as a: 73 | patt = Path(a.name) 74 | plugin_name = patt.stem.replace(".py", "") 75 | plugins_dir = Path(f"plugins/{plugin_name}.py") 76 | import_path = "plugins.{}".format(plugin_name) 77 | spec = importlib.util.spec_from_file_location(import_path, plugins_dir) 78 | load = importlib.util.module_from_spec(spec) 79 | spec.loader.exec_module(load) 80 | sys.modules["plugins." + plugin_name] = load 81 | print("Tech VJ Imported => " + plugin_name) 82 | if ON_HEROKU: 83 | asyncio.create_task(ping_server()) 84 | me = await StreamBot.get_me() 85 | tz = pytz.timezone('Asia/Kolkata') 86 | today = date.today() 87 | now = datetime.now(tz) 88 | time = now.strftime("%H:%M:%S %p") 89 | app = web.AppRunner(await web_server()) 90 | await StreamBot.send_message(chat_id=LOG_CHANNEL, text=script.RESTART_TXT.format(today, time)) 91 | await app.setup() 92 | bind_address = "0.0.0.0" 93 | await web.TCPSite(app, bind_address, PORT).start() 94 | if CLONE_MODE == True: 95 | await restart_bots() 96 | print("Bot Started Powered By @VJ_Botz") 97 | await idle() 98 | 99 | # Don't Remove Credit Tg - @VJ_Botz 100 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 101 | # Ask Doubt on telegram @KingVJ01 102 | 103 | if __name__ == '__main__': 104 | try: 105 | loop.run_until_complete(start()) 106 | except KeyboardInterrupt: 107 | logging.info('Service Stopped Bye 👋') 108 | 109 | 110 | # Don't Remove Credit Tg - @VJ_Botz 111 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 112 | # Ask Doubt on telegram @KingVJ01 113 | -------------------------------------------------------------------------------- /clone_plugins/TechVJ: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /clone_plugins/broadcast.py: -------------------------------------------------------------------------------- 1 | # Don't Remove Credit @VJ_Botz 2 | # Subscribe YouTube Channel For Amazing Bot @Tech_VJ 3 | # Ask Doubt on telegram @KingVJ01 4 | 5 | # Clone Code Credit : YT - @Tech_VJ / TG - @VJ_Bots / GitHub - @VJBots 6 | 7 | import datetime, time, asyncio 8 | from pyrogram import Client, filters 9 | from plugins.clone import mongo_db 10 | from pyrogram.errors import * 11 | from clone_plugins.dbusers import clonedb 12 | 13 | @Client.on_message(filters.command("broadcast")) 14 | async def pm_broadcast(bot, message): 15 | me = await bot.get_me() 16 | owner = mongo_db.bots.find_one({'bot_id': me.id}) 17 | ownerid = int(owner['user_id']) 18 | if ownerid != message.from_user.id: 19 | await message.reply_text("ᴏɴʟʏ ᴏᴡɴᴇʀ ᴄᴏᴍᴍᴀɴᴅ❗") 20 | return 21 | b_msg = await bot.ask(chat_id = message.from_user.id, text = "Now Send Me Your Broadcast Message") 22 | try: 23 | users = await clonedb.get_all_users(me.id) 24 | sts = await message.reply_text('Broadcasting your messages...') 25 | start_time = time.time() 26 | total_users = await clonedb.total_users_count(me.id) 27 | done = 0 28 | blocked = 0 29 | deleted = 0 30 | failed = 0 31 | success = 0 32 | async for user in users: 33 | if 'user_id' in user: 34 | pti, sh = await broadcast_messages(me.id, int(user['user_id']), b_msg) 35 | if pti: 36 | success += 1 37 | elif pti == False: 38 | if sh == "Blocked": 39 | blocked += 1 40 | elif sh == "Deleted": 41 | deleted += 1 42 | elif sh == "Error": 43 | failed += 1 44 | done += 1 45 | if not done % 20: 46 | await sts.edit(f"Broadcast in progress:\n\nTotal Users {total_users}\nCompleted: {done} / {total_users}\nSuccess: {success}\nBlocked: {blocked}\nDeleted: {deleted}") 47 | else: 48 | # Handle the case where 'id' key is missing in the user dictionary 49 | done += 1 50 | failed += 1 51 | if not done % 20: 52 | await sts.edit(f"Broadcast in progress:\n\nTotal Users {total_users}\nCompleted: {done} / {total_users}\nSuccess: {success}\nBlocked: {blocked}\nDeleted: {deleted}") 53 | 54 | time_taken = datetime.timedelta(seconds=int(time.time()-start_time)) 55 | await sts.edit(f"Broadcast Completed:\nCompleted in {time_taken} seconds.\n\nTotal Users: {total_users}\nCompleted: {done} / {total_users}\nSuccess: {success}\nBlocked: {blocked}\nDeleted: {deleted}") 56 | except Exception as e: 57 | print(f"error: {e}") 58 | 59 | # Don't Remove Credit Tg - @VJ_Botz 60 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 61 | # Ask Doubt on telegram @KingVJ01 62 | 63 | async def broadcast_messages(bot_id, user_id, message): 64 | try: 65 | await message.copy(chat_id=user_id) 66 | return True, "Success" 67 | except FloodWait as e: 68 | await asyncio.sleep(e.value) 69 | return await broadcast_messages(bot_id, user_id, message) 70 | except InputUserDeactivated: 71 | await clonedb.delete_user(bot_id, user_id) 72 | return False, "Deleted" 73 | except UserIsBlocked: 74 | await clonedb.delete_user(bot_id, user_id) 75 | return False, "Blocked" 76 | except PeerIdInvalid: 77 | await clonedb.delete_user(bot_id, user_id) 78 | return False, "Error" 79 | except Exception as e: 80 | await clonedb.delete_user(bot_id, user_id) 81 | return False, "Error" 82 | 83 | # Don't Remove Credit Tg - @VJ_Botz 84 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 85 | # Ask Doubt on telegram @KingVJ01 86 | -------------------------------------------------------------------------------- /clone_plugins/commands.py: -------------------------------------------------------------------------------- 1 | # Don't Remove Credit Tg - @VJ_Botz 2 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 3 | # Ask Doubt on telegram @KingVJ01 4 | 5 | import os 6 | import logging 7 | import random 8 | import asyncio 9 | from Script import script 10 | from validators import domain 11 | from clone_plugins.dbusers import clonedb 12 | from clone_plugins.users_api import get_user, update_user_info 13 | from pyrogram import Client, filters, enums 14 | from plugins.clone import mongo_db 15 | from pyrogram.errors import ChatAdminRequired, FloodWait 16 | from config import BOT_USERNAME, ADMINS 17 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message, CallbackQuery, InputMediaPhoto 18 | from config import PICS, CUSTOM_FILE_CAPTION, AUTO_DELETE_TIME, AUTO_DELETE 19 | import re 20 | import json 21 | import base64 22 | 23 | logger = logging.getLogger(__name__) 24 | 25 | # Don't Remove Credit Tg - @VJ_Botz 26 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 27 | # Ask Doubt on telegram @KingVJ01 28 | 29 | def get_size(size): 30 | """Get size in readable format""" 31 | 32 | units = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB"] 33 | size = float(size) 34 | i = 0 35 | while size >= 1024.0 and i < len(units): 36 | i += 1 37 | size /= 1024.0 38 | return "%.2f %s" % (size, units[i]) 39 | 40 | # Don't Remove Credit Tg - @VJ_Botz 41 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 42 | # Ask Doubt on telegram @KingVJ01 43 | 44 | @Client.on_message(filters.command("start") & filters.incoming) 45 | async def start(client, message): 46 | me = await client.get_me() 47 | if not await clonedb.is_user_exist(me.id, message.from_user.id): 48 | await clonedb.add_user(me.id, message.from_user.id) 49 | if len(message.command) != 2: 50 | buttons = [[ 51 | InlineKeyboardButton('💝 sᴜʙsᴄʀɪʙᴇ ᴍʏ ʏᴏᴜᴛᴜʙᴇ ᴄʜᴀɴɴᴇʟ', url='https://youtube.com/@Tech_VJ') 52 | ],[ 53 | InlineKeyboardButton('🤖 ᴄʀᴇᴀᴛᴇ ʏᴏᴜʀ ᴏᴡɴ ᴄʟᴏɴᴇ ʙᴏᴛ', url=f'https://t.me/{BOT_USERNAME}?start=clone') 54 | ],[ 55 | InlineKeyboardButton('💁‍♀️ ʜᴇʟᴘ', callback_data='help'), 56 | InlineKeyboardButton('ᴀʙᴏᴜᴛ 🔻', callback_data='about') 57 | ]] 58 | reply_markup = InlineKeyboardMarkup(buttons) 59 | await message.reply_photo( 60 | photo=random.choice(PICS), 61 | caption=script.CLONE_START_TXT.format(message.from_user.mention, me.mention), 62 | reply_markup=reply_markup 63 | ) 64 | return 65 | 66 | # Don't Remove Credit Tg - @VJ_Botz 67 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 68 | # Ask Doubt on telegram @KingVJ01 69 | 70 | data = message.command[1] 71 | try: 72 | pre, file_id = data.split('_', 1) 73 | except: 74 | file_id = data 75 | pre = "" 76 | 77 | pre, file_id = ((base64.urlsafe_b64decode(data + "=" * (-len(data) % 4))).decode("ascii")).split("_", 1) 78 | try: 79 | msg = await client.send_cached_media( 80 | chat_id=message.from_user.id, 81 | file_id=file_id, 82 | protect_content=True if pre == 'filep' else False, 83 | ) 84 | filetype = msg.media 85 | file = getattr(msg, filetype.value) 86 | title = '@VJ_Botz ' + ' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@'), file.file_name.split())) 87 | size=get_size(file.file_size) 88 | f_caption = f"{title}" 89 | if CUSTOM_FILE_CAPTION: 90 | try: 91 | f_caption=CUSTOM_FILE_CAPTION.format(file_name= '' if title is None else title, file_size='' if size is None else size, file_caption='') 92 | except: 93 | return 94 | await msg.edit_caption(f_caption) 95 | k = await msg.reply(f"❗️❗️❗️IMPORTANT❗️️❗️❗️\n\nThis Movie File/Video will be deleted in {AUTO_DELETE} mins 🫥 (Due to Copyright Issues).\n\nPlease forward this File/Video to your Saved Messages and Start Download there",quote=True) 96 | await asyncio.sleep(AUTO_DELETE_TIME) 97 | await msg.delete() 98 | await k.edit_text("Your File/Video is successfully deleted!!!") 99 | return 100 | except: 101 | pass 102 | 103 | # Don't Remove Credit Tg - @VJ_Botz 104 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 105 | # Ask Doubt on telegram @KingVJ01 106 | 107 | @Client.on_message(filters.command('api') & filters.private) 108 | async def shortener_api_handler(client, m: Message): 109 | user_id = m.from_user.id 110 | user = await get_user(user_id) 111 | cmd = m.command 112 | 113 | if len(cmd) == 1: 114 | s = script.SHORTENER_API_MESSAGE.format(base_site=user["base_site"], shortener_api=user["shortener_api"]) 115 | return await m.reply(s) 116 | 117 | elif len(cmd) == 2: 118 | api = cmd[1].strip() 119 | await update_user_info(user_id, {"shortener_api": api}) 120 | await m.reply("Shortener API updated successfully to " + api) 121 | else: 122 | await m.reply("You are not authorized to use this command.") 123 | 124 | # Don't Remove Credit Tg - @VJ_Botz 125 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 126 | # Ask Doubt on telegram @KingVJ01 127 | 128 | @Client.on_message(filters.command("base_site") & filters.private) 129 | async def base_site_handler(client, m: Message): 130 | user_id = m.from_user.id 131 | user = await get_user(user_id) 132 | cmd = m.command 133 | text = f"/base_site (base_site)\n\nCurrent base site: None\n\n EX: /base_site shortnerdomain.com\n\nIf You Want To Remove Base Site Then Copy This And Send To Bot - `/base_site None`" 134 | 135 | if len(cmd) == 1: 136 | return await m.reply(text=text, disable_web_page_preview=True) 137 | elif len(cmd) == 2: 138 | base_site = cmd[1].strip() 139 | if not domain(base_site): 140 | return await m.reply(text=text, disable_web_page_preview=True) 141 | await update_user_info(user_id, {"base_site": base_site}) 142 | await m.reply("Base Site updated successfully") 143 | else: 144 | await m.reply("You are not authorized to use this command.") 145 | 146 | # Don't Remove Credit Tg - @VJ_Botz 147 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 148 | # Ask Doubt on telegram @KingVJ01 149 | 150 | 151 | @Client.on_callback_query() 152 | async def cb_handler(client: Client, query: CallbackQuery): 153 | me = await client.get_me() 154 | if query.data == "close_data": 155 | await query.message.delete() 156 | elif query.data == "start": 157 | buttons = [[ 158 | InlineKeyboardButton('💝 sᴜʙsᴄʀɪʙᴇ ᴍʏ ʏᴏᴜᴛᴜʙᴇ ᴄʜᴀɴɴᴇʟ', url='https://youtube.com/@Tech_VJ') 159 | ],[ 160 | InlineKeyboardButton('🤖 ᴄʀᴇᴀᴛᴇ ʏᴏᴜʀ ᴏᴡɴ ᴄʟᴏɴᴇ ʙᴏᴛ', url=f'https://t.me/{BOT_USERNAME}?start=clone') 161 | ],[ 162 | InlineKeyboardButton('💁‍♀️ ʜᴇʟᴘ', callback_data='help'), 163 | InlineKeyboardButton('ᴀʙᴏᴜᴛ 🔻', callback_data='about') 164 | ]] 165 | 166 | reply_markup = InlineKeyboardMarkup(buttons) 167 | await client.edit_message_media( 168 | query.message.chat.id, 169 | query.message.id, 170 | InputMediaPhoto(random.choice(PICS)) 171 | ) 172 | await query.message.edit_text( 173 | text=script.CLONE_START_TXT.format(query.from_user.mention, me.mention), 174 | reply_markup=reply_markup, 175 | parse_mode=enums.ParseMode.HTML 176 | ) 177 | 178 | # Don't Remove Credit Tg - @VJ_Botz 179 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 180 | # Ask Doubt on telegram @KingVJ01 181 | 182 | elif query.data == "help": 183 | buttons = [[ 184 | InlineKeyboardButton('Hᴏᴍᴇ', callback_data='start'), 185 | InlineKeyboardButton('🔒 Cʟᴏsᴇ', callback_data='close_data') 186 | ]] 187 | await client.edit_message_media( 188 | query.message.chat.id, 189 | query.message.id, 190 | InputMediaPhoto(random.choice(PICS)) 191 | ) 192 | reply_markup = InlineKeyboardMarkup(buttons) 193 | await query.message.edit_text( 194 | text=script.CHELP_TXT, 195 | reply_markup=reply_markup, 196 | parse_mode=enums.ParseMode.HTML 197 | ) 198 | 199 | elif query.data == "about": 200 | buttons = [[ 201 | InlineKeyboardButton('Hᴏᴍᴇ', callback_data='start'), 202 | InlineKeyboardButton('🔒 Cʟᴏsᴇ', callback_data='close_data') 203 | ]] 204 | await client.edit_message_media( 205 | query.message.chat.id, 206 | query.message.id, 207 | InputMediaPhoto(random.choice(PICS)) 208 | ) 209 | owner = mongo_db.bots.find_one({'bot_id': me.id}) 210 | ownerid = int(owner['user_id']) 211 | reply_markup = InlineKeyboardMarkup(buttons) 212 | await query.message.edit_text( 213 | text=script.CABOUT_TXT.format(me.mention, ownerid), 214 | reply_markup=reply_markup, 215 | parse_mode=enums.ParseMode.HTML 216 | ) 217 | 218 | # Don't Remove Credit Tg - @VJ_Botz 219 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 220 | # Ask Doubt on telegram @KingVJ01 221 | -------------------------------------------------------------------------------- /clone_plugins/dbusers.py: -------------------------------------------------------------------------------- 1 | import motor.motor_asyncio 2 | from config import CDB_NAME, CLONE_DB_URI 3 | 4 | class Database: 5 | 6 | def __init__(self, uri, database_name): 7 | self._client = motor.motor_asyncio.AsyncIOMotorClient(uri) 8 | self.db = self._client[database_name] 9 | 10 | async def add_user(self, bot_id, user_id): 11 | user = {'user_id': int(user_id)} 12 | await self.db[str(bot_id)].insert_one(user) 13 | 14 | async def is_user_exist(self, bot_id, id): 15 | user = await self.db[str(bot_id)].find_one({'user_id': int(id)}) 16 | return bool(user) 17 | 18 | async def total_users_count(self, bot_id): 19 | count = await self.db[str(bot_id)].count_documents({}) 20 | return count 21 | 22 | async def get_all_users(self, bot_id): 23 | return self.db[str(bot_id)].find({}) 24 | 25 | async def delete_user(self, bot_id, user_id): 26 | await self.db[str(bot_id)].delete_many({'user_id': int(user_id)}) 27 | 28 | 29 | clonedb = Database(CLONE_DB_URI, CDB_NAME) 30 | -------------------------------------------------------------------------------- /clone_plugins/genlink.py: -------------------------------------------------------------------------------- 1 | # Don't Remove Credit @VJ_Botz 2 | # Subscribe YouTube Channel For Amazing Bot @Tech_VJ 3 | # Ask Doubt on telegram @KingVJ01 4 | 5 | import re 6 | from pyrogram import filters, Client, enums 7 | from clone_plugins.users_api import get_user, get_short_link 8 | import base64 9 | 10 | # Don't Remove Credit Tg - @VJ_Botz 11 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 12 | # Ask Doubt on telegram @KingVJ01 13 | 14 | @Client.on_message(filters.command(['link'])) 15 | async def gen_link_s(client: Client, message): 16 | replied = message.reply_to_message 17 | if not replied: 18 | return await message.reply('Reply to a message to get a shareable link.') 19 | file_type = replied.media 20 | if file_type not in [enums.MessageMediaType.VIDEO, enums.MessageMediaType.AUDIO, enums.MessageMediaType.DOCUMENT]: 21 | return await message.reply("Reply to a supported media") 22 | 23 | # Don't Remove Credit Tg - @VJ_Botz 24 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 25 | # Ask Doubt on telegram @KingVJ01 26 | 27 | file_id = getattr(replied, file_type.value).file_id 28 | string = 'file_' 29 | string += file_id 30 | outstr = base64.urlsafe_b64encode(string.encode("ascii")).decode().strip("=") 31 | user_id = message.from_user.id 32 | user = await get_user(user_id) 33 | # Get the bot's username 34 | bot_username = (await client.get_me()).username 35 | share_link = f"https://t.me/{bot_username}?start={outstr}" 36 | if user["shortener_api"]: 37 | await message.reply(f"⭕ ʜᴇʀᴇ ɪs ʏᴏᴜʀ ʟɪɴᴋ:\n\n🔗 ᴏʀɪɢɪɴᴀʟ ʟɪɴᴋ :- {share_link}") 38 | else: 39 | short_link = await get_short_link(user, share_link) 40 | await message.reply(f"⭕ ʜᴇʀᴇ ɪs ʏᴏᴜʀ ʟɪɴᴋ:\n\n🖇️ sʜᴏʀᴛ ʟɪɴᴋ :- {short_link}") 41 | 42 | 43 | # Don't Remove Credit Tg - @VJ_Botz 44 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 45 | # Ask Doubt on telegram @KingVJ01 46 | 47 | -------------------------------------------------------------------------------- /clone_plugins/users_api.py: -------------------------------------------------------------------------------- 1 | # © Telegram : @KingVJ01 , GitHub : @VJBots 2 | 3 | # Don't Remove Credit Tg - @VJ_Botz 4 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 5 | # Ask Doubt on telegram @KingVJ01 6 | 7 | import requests 8 | import json 9 | from motor.motor_asyncio import AsyncIOMotorClient 10 | from config import CLONE_DB_URI, CDB_NAME 11 | 12 | # Don't Remove Credit Tg - @VJ_Botz 13 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 14 | # Ask Doubt on telegram @KingVJ01 15 | 16 | client = AsyncIOMotorClient(CLONE_DB_URI) 17 | db = client[CDB_NAME] 18 | col = db["users"] 19 | 20 | # Don't Remove Credit Tg - @VJ_Botz 21 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 22 | # Ask Doubt on telegram @KingVJ01 23 | 24 | async def get_short_link(user, link): 25 | api_key = user["shortener_api"] 26 | base_site = user["base_site"] 27 | print(user) 28 | response = requests.get(f"https://{base_site}/api?api={api_key}&url={link}") 29 | data = response.json() 30 | if data["status"] == "success" or rget.status_code == 200: 31 | return data["shortenedUrl"] 32 | 33 | # Don't Remove Credit Tg - @VJ_Botz 34 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 35 | # Ask Doubt on telegram @KingVJ01 36 | 37 | async def get_user(user_id): 38 | user_id = int(user_id) 39 | user = await col.find_one({"user_id": user_id}) 40 | if not user: 41 | res = { 42 | "user_id": user_id, 43 | "shortener_api": None, 44 | "base_site": None, 45 | } 46 | await col.insert_one(res) 47 | user = await col.find_one({"user_id": user_id}) 48 | return user 49 | 50 | # Don't Remove Credit Tg - @VJ_Botz 51 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 52 | # Ask Doubt on telegram @KingVJ01 53 | 54 | async def update_user_info(user_id, value:dict): 55 | user_id = int(user_id) 56 | myquery = {"user_id": user_id} 57 | newvalues = { "$set": value } 58 | await col.update_one(myquery, newvalues) 59 | 60 | # Don't Remove Credit Tg - @VJ_Botz 61 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 62 | # Ask Doubt on telegram @KingVJ01 63 | -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | # Don't Remove Credit Tg - @VJ_Botz 2 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 3 | # Ask Doubt on telegram @KingVJ01 4 | 5 | 6 | import re 7 | import os 8 | from os import environ 9 | from Script import script 10 | 11 | id_pattern = re.compile(r'^.\d+$') 12 | def is_enabled(value, default): 13 | if value.lower() in ["true", "yes", "1", "enable", "y"]: 14 | return True 15 | elif value.lower() in ["false", "no", "0", "disable", "n"]: 16 | return False 17 | else: 18 | return default 19 | 20 | # Bot Information 21 | API_ID = int(environ.get("API_ID", "")) 22 | API_HASH = environ.get("API_HASH", "") 23 | BOT_TOKEN = environ.get("BOT_TOKEN", "") 24 | 25 | PICS = (environ.get('PICS', 'https://graph.org/file/ce1723991756e48c35aa1.jpg')).split() # Bot Start Picture 26 | ADMINS = [int(admin) if id_pattern.search(admin) else admin for admin in environ.get('ADMINS', '').split()] 27 | BOT_USERNAME = environ.get("BOT_USERNAME", "") # without @ 28 | PORT = environ.get("PORT", "8080") 29 | 30 | # Clone Info :- 31 | CLONE_MODE = bool(environ.get('CLONE_MODE', False)) # Set True or False 32 | 33 | # If Clone Mode Is True Then Fill All Required Variable, If False Then Don't Fill. 34 | CLONE_DB_URI = environ.get("CLONE_DB_URI", "") 35 | CDB_NAME = environ.get("CDB_NAME", "clonetechvj") 36 | 37 | # Database Information 38 | DB_URI = environ.get("DB_URI", "") 39 | DB_NAME = environ.get("DB_NAME", "techvjbotz") 40 | 41 | # Auto Delete Information 42 | AUTO_DELETE_MODE = bool(environ.get('AUTO_DELETE_MODE', True)) # Set True or False 43 | 44 | # If Auto Delete Mode Is True Then Fill All Required Variable, If False Then Don't Fill. 45 | AUTO_DELETE = int(environ.get("AUTO_DELETE", "30")) # Time in Minutes 46 | AUTO_DELETE_TIME = int(environ.get("AUTO_DELETE_TIME", "1800")) # Time in Seconds 47 | 48 | # Channel Information 49 | LOG_CHANNEL = int(environ.get("LOG_CHANNEL", "")) 50 | 51 | # File Caption Information 52 | CUSTOM_FILE_CAPTION = environ.get("CUSTOM_FILE_CAPTION", f"{script.CAPTION}") 53 | BATCH_FILE_CAPTION = environ.get("BATCH_FILE_CAPTION", CUSTOM_FILE_CAPTION) 54 | 55 | # Enable - True or Disable - False 56 | PUBLIC_FILE_STORE = is_enabled((environ.get('PUBLIC_FILE_STORE', "True")), True) 57 | 58 | # Verify Info :- 59 | VERIFY_MODE = bool(environ.get('VERIFY_MODE', False)) # Set True or False 60 | 61 | # If Verify Mode Is True Then Fill All Required Variable, If False Then Don't Fill. 62 | SHORTLINK_URL = environ.get("SHORTLINK_URL", "") # shortlink domain without https:// 63 | SHORTLINK_API = environ.get("SHORTLINK_API", "") # shortlink api 64 | VERIFY_TUTORIAL = environ.get("VERIFY_TUTORIAL", "") # how to open link 65 | 66 | # Website Info: 67 | WEBSITE_URL_MODE = bool(environ.get('WEBSITE_URL_MODE', False)) # Set True or False 68 | 69 | # If Website Url Mode Is True Then Fill All Required Variable, If False Then Don't Fill. 70 | WEBSITE_URL = environ.get("WEBSITE_URL", "") # For More Information Check Video On Yt - @Tech_VJ 71 | 72 | # File Stream Config 73 | STREAM_MODE = bool(environ.get('STREAM_MODE', True)) # Set True or False 74 | 75 | # If Stream Mode Is True Then Fill All Required Variable, If False Then Don't Fill. 76 | MULTI_CLIENT = False 77 | SLEEP_THRESHOLD = int(environ.get('SLEEP_THRESHOLD', '60')) 78 | PING_INTERVAL = int(environ.get("PING_INTERVAL", "1200")) # 20 minutes 79 | if 'DYNO' in environ: 80 | ON_HEROKU = True 81 | else: 82 | ON_HEROKU = False 83 | URL = environ.get("URL", "https://testofvjfilter-1fa60b1b8498.herokuapp.com/") 84 | 85 | 86 | # Don't Remove Credit Tg - @VJ_Botz 87 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 88 | # Ask Doubt on telegram @KingVJ01 89 | 90 | -------------------------------------------------------------------------------- /logging.conf: -------------------------------------------------------------------------------- 1 | [loggers] 2 | keys=root 3 | 4 | [handlers] 5 | keys=consoleHandler,fileHandler 6 | 7 | [formatters] 8 | keys=consoleFormatter,fileFormatter 9 | 10 | [logger_root] 11 | level=DEBUG 12 | handlers=consoleHandler,fileHandler 13 | 14 | [handler_consoleHandler] 15 | class=StreamHandler 16 | level=INFO 17 | formatter=consoleFormatter 18 | args=(sys.stdout,) 19 | 20 | [handler_fileHandler] 21 | class=FileHandler 22 | level=ERROR 23 | formatter=fileFormatter 24 | args=('TELEGRAM BOT.LOG','w',) 25 | 26 | [formatter_consoleFormatter] 27 | format=%(asctime)s - %(lineno)d - %(name)s - %(module)s - %(levelname)s - %(message)s 28 | datefmt=%I:%M:%S %p 29 | 30 | [formatter_fileFormatter] 31 | format=[%(asctime)s:%(name)s:%(lineno)d:%(levelname)s] %(message)s 32 | datefmt=%m/%d/%Y %I:%M:%S %p 33 | -------------------------------------------------------------------------------- /plugins/TechVJ: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /plugins/broadcast.py: -------------------------------------------------------------------------------- 1 | # Don't Remove Credit Tg - @VJ_Botz 2 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 3 | # Ask Doubt on telegram @KingVJ01 4 | 5 | from pyrogram.errors import InputUserDeactivated, UserNotParticipant, FloodWait, UserIsBlocked, PeerIdInvalid 6 | from plugins.dbusers import db 7 | from pyrogram import Client, filters 8 | from config import ADMINS 9 | import asyncio 10 | import datetime 11 | import time 12 | 13 | # Don't Remove Credit Tg - @VJ_Botz 14 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 15 | # Ask Doubt on telegram @KingVJ01 16 | 17 | async def broadcast_messages(user_id, message): 18 | try: 19 | await message.copy(chat_id=user_id) 20 | return True, "Success" 21 | except FloodWait as e: 22 | await asyncio.sleep(e.value) 23 | return await broadcast_messages(user_id, message) 24 | except InputUserDeactivated: 25 | await db.delete_user(int(user_id)) 26 | return False, "Deleted" 27 | except UserIsBlocked: 28 | await db.delete_user(int(user_id)) 29 | return False, "Blocked" 30 | except PeerIdInvalid: 31 | await db.delete_user(int(user_id)) 32 | return False, "Error" 33 | except Exception as e: 34 | return False, "Error" 35 | 36 | # Don't Remove Credit Tg - @VJ_Botz 37 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 38 | # Ask Doubt on telegram @KingVJ01 39 | 40 | 41 | @Client.on_message(filters.command("broadcast") & filters.user(ADMINS) & filters.reply) 42 | async def verupikkals(bot, message): 43 | users = await db.get_all_users() 44 | b_msg = message.reply_to_message 45 | sts = await message.reply_text(text='**Broadcasting your messages...**') 46 | start_time = time.time() 47 | total_users = await db.total_users_count() 48 | done = 0 49 | blocked = 0 50 | deleted = 0 51 | failed = 0 52 | success = 0 53 | 54 | # Don't Remove Credit Tg - @VJ_Botz 55 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 56 | # Ask Doubt on telegram @KingVJ01 57 | 58 | async for user in users: 59 | if 'id' in user: 60 | pti, sh = await broadcast_messages(int(user['id']), b_msg) 61 | if pti: 62 | success += 1 63 | elif pti == False: 64 | if sh == "Blocked": 65 | blocked += 1 66 | elif sh == "Deleted": 67 | deleted += 1 68 | elif sh == "Error": 69 | failed += 1 70 | done += 1 71 | if not done % 20: 72 | try: 73 | await sts.edit(f"Broadcast in progress:\n\nTotal Users {total_users}\nCompleted: {done} / {total_users}\nSuccess: {success}\nBlocked: {blocked}\nDeleted: {deleted}") 74 | except: 75 | pass 76 | else: 77 | # Handle the case where 'id' key is missing in the user dictionary 78 | done += 1 79 | failed += 1 80 | if not done % 20: 81 | try: 82 | await sts.edit(f"Broadcast in progress:\n\nTotal Users {total_users}\nCompleted: {done} / {total_users}\nSuccess: {success}\nBlocked: {blocked}\nDeleted: {deleted}") 83 | except: 84 | pass 85 | 86 | time_taken = datetime.timedelta(seconds=int(time.time()-start_time)) 87 | await sts.edit(f"Broadcast Completed:\nCompleted in {time_taken} seconds.\n\nTotal Users {total_users}\nCompleted: {done} / {total_users}\nSuccess: {success}\nBlocked: {blocked}\nDeleted: {deleted}") 88 | 89 | # Don't Remove Credit Tg - @VJ_Botz 90 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 91 | # Ask Doubt on telegram @KingVJ01 92 | 93 | -------------------------------------------------------------------------------- /plugins/clone.py: -------------------------------------------------------------------------------- 1 | # Don't Remove Credit Tg - @VJ_Botz 2 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 3 | # Ask Doubt on telegram @KingVJ01 4 | 5 | import re 6 | from pymongo import MongoClient 7 | from Script import script 8 | from pyrogram import Client, filters 9 | from pyrogram.types import Message 10 | from pyrogram.errors.exceptions.bad_request_400 import AccessTokenExpired, AccessTokenInvalid 11 | from config import API_ID, API_HASH, DB_URI, DB_NAME, CLONE_MODE 12 | 13 | mongo_client = MongoClient(DB_URI) 14 | mongo_db = mongo_client["cloned_vjbotz"] 15 | 16 | @Client.on_message(filters.command("clone") & filters.private) 17 | async def clone(client, message): 18 | if CLONE_MODE == False: 19 | return 20 | techvj = await client.ask(message.chat.id, "1) sᴇɴᴅ /newbot ᴛᴏ @BotFather\n2) ɢɪᴠᴇ ᴀ ɴᴀᴍᴇ ꜰᴏʀ ʏᴏᴜʀ ʙᴏᴛ.\n3) ɢɪᴠᴇ ᴀ ᴜɴɪǫᴜᴇ ᴜsᴇʀɴᴀᴍᴇ.\n4) ᴛʜᴇɴ ʏᴏᴜ ᴡɪʟʟ ɢᴇᴛ ᴀ ᴍᴇssᴀɢᴇ ᴡɪᴛʜ ʏᴏᴜʀ ʙᴏᴛ ᴛᴏᴋᴇɴ.\n5) ꜰᴏʀᴡᴀʀᴅ ᴛʜᴀᴛ ᴍᴇssᴀɢᴇ ᴛᴏ ᴍᴇ.\n\n/cancel - ᴄᴀɴᴄᴇʟ ᴛʜɪs ᴘʀᴏᴄᴇss.") 21 | if techvj.text == '/cancel': 22 | await techvj.delete() 23 | return await message.reply('ᴄᴀɴᴄᴇʟᴇᴅ ᴛʜɪs ᴘʀᴏᴄᴇss 🚫') 24 | if techvj.forward_from and techvj.forward_from.id == 93372553: 25 | try: 26 | bot_token = re.findall(r"\b(\d+:[A-Za-z0-9_-]+)\b", techvj.text)[0] 27 | except: 28 | return await message.reply('sᴏᴍᴇᴛʜɪɴɢ ᴡᴇɴᴛ ᴡʀᴏɴɢ 😕') 29 | else: 30 | return await message.reply('ɴᴏᴛ ꜰᴏʀᴡᴀʀᴅᴇᴅ ꜰʀᴏᴍ @BotFather 😑') 31 | user_id = message.from_user.id 32 | msg = await message.reply_text("**👨‍💻 ᴡᴀɪᴛ ᴀ ᴍɪɴᴜᴛᴇ ɪ ᴀᴍ ᴄʀᴇᴀᴛɪɴɢ ʏᴏᴜʀ ʙᴏᴛ ❣️**") 33 | try: 34 | vj = Client( 35 | f"{bot_token}", API_ID, API_HASH, 36 | bot_token=bot_token, 37 | plugins={"root": "clone_plugins"} 38 | ) 39 | await vj.start() 40 | bot = await vj.get_me() 41 | details = { 42 | 'bot_id': bot.id, 43 | 'is_bot': True, 44 | 'user_id': user_id, 45 | 'name': bot.first_name, 46 | 'token': bot_token, 47 | 'username': bot.username 48 | } 49 | mongo_db.bots.insert_one(details) 50 | await msg.edit_text(f"sᴜᴄᴄᴇssғᴜʟʟʏ ᴄʟᴏɴᴇᴅ ʏᴏᴜʀ ʙᴏᴛ: @{bot.username}.") 51 | except BaseException as e: 52 | await msg.edit_text(f"⚠️ Bot Error:\n\n{e}\n\n**Kindly forward this message to @KingVJ01 to get assistance.**") 53 | 54 | @Client.on_message(filters.command("deletecloned") & filters.private) 55 | async def delete_cloned_bot(client, message): 56 | if CLONE_MODE == False: 57 | return 58 | try: 59 | techvj = await client.ask(message.chat.id, "**Send Me Bot Token To Delete**") 60 | bot_token = re.findall(r'\d[0-9]{8,10}:[0-9A-Za-z_-]{35}', techvj.text, re.IGNORECASE) 61 | bot_token = bot_token[0] if bot_token else None 62 | bot_id = re.findall(r'\d[0-9]{8,10}', techvj.text) 63 | cloned_bot = mongo_db.bots.find_one({"token": bot_token}) 64 | if cloned_bot: 65 | mongo_db.bots.delete_one({"token": bot_token}) 66 | await message.reply_text("**🤖 ᴛʜᴇ ᴄʟᴏɴᴇᴅ ʙᴏᴛ ʜᴀs ʙᴇᴇɴ ʀᴇᴍᴏᴠᴇᴅ ғʀᴏᴍ ᴛʜᴇ ʟɪsᴛ ᴀɴᴅ ɪᴛs ᴅᴇᴛᴀɪʟs ʜᴀᴠᴇ ʙᴇᴇɴ ʀᴇᴍᴏᴠᴇᴅ ғʀᴏᴍ ᴛʜᴇ ᴅᴀᴛᴀʙᴀsᴇ. ☠️**") 67 | else: 68 | await message.reply_text("**⚠️ ᴛʜᴇ ʙᴏᴛ ᴛᴏᴋᴇɴ ᴘʀᴏᴠɪᴅᴇᴅ ɪs ɴᴏᴛ ɪɴ ᴛʜᴇ ᴄʟᴏɴᴇᴅ ʟɪsᴛ.**") 69 | except: 70 | await message.reply_text("An error occurred while deleting the cloned bot.") 71 | 72 | # Don't Remove Credit Tg - @VJ_Botz 73 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 74 | # Ask Doubt on telegram @KingVJ01 75 | 76 | async def restart_bots(): 77 | bots = list(mongo_db.bots.find()) 78 | for bot in bots: 79 | bot_token = bot['token'] 80 | try: 81 | vj = Client( 82 | f"{bot_token}", API_ID, API_HASH, 83 | bot_token=bot_token, 84 | plugins={"root": "clone_plugins"}, 85 | ) 86 | await vj.start() 87 | except: 88 | pass 89 | -------------------------------------------------------------------------------- /plugins/commands.py: -------------------------------------------------------------------------------- 1 | # Don't Remove Credit Tg - @VJ_Botz 2 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 3 | # Ask Doubt on telegram @KingVJ01 4 | 5 | import os 6 | import logging 7 | import random 8 | import asyncio 9 | from validators import domain 10 | from Script import script 11 | from plugins.dbusers import db 12 | from pyrogram import Client, filters, enums 13 | from plugins.users_api import get_user, update_user_info 14 | from pyrogram.errors import ChatAdminRequired, FloodWait 15 | from pyrogram.types import * 16 | from utils import verify_user, check_token, check_verification, get_token 17 | from config import * 18 | import re 19 | import json 20 | import base64 21 | from urllib.parse import quote_plus 22 | from TechVJ.utils.file_properties import get_name, get_hash, get_media_file_size 23 | logger = logging.getLogger(__name__) 24 | 25 | BATCH_FILES = {} 26 | 27 | # Don't Remove Credit Tg - @VJ_Botz 28 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 29 | # Ask Doubt on telegram @KingVJ01 30 | 31 | 32 | def get_size(size): 33 | """Get size in readable format""" 34 | 35 | units = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB"] 36 | size = float(size) 37 | i = 0 38 | while size >= 1024.0 and i < len(units): 39 | i += 1 40 | size /= 1024.0 41 | return "%.2f %s" % (size, units[i]) 42 | 43 | def formate_file_name(file_name): 44 | chars = ["[", "]", "(", ")"] 45 | for c in chars: 46 | file_name.replace(c, "") 47 | file_name = '@VJ_Botz ' + ' '.join(filter(lambda x: not x.startswith('http') and not x.startswith('@') and not x.startswith('www.'), file_name.split())) 48 | return file_name 49 | 50 | # Don't Remove Credit Tg - @VJ_Botz 51 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 52 | # Ask Doubt on telegram @KingVJ0 53 | 54 | 55 | @Client.on_message(filters.command("start") & filters.incoming) 56 | async def start(client, message): 57 | username = client.me.username 58 | if not await db.is_user_exist(message.from_user.id): 59 | await db.add_user(message.from_user.id, message.from_user.first_name) 60 | await client.send_message(LOG_CHANNEL, script.LOG_TEXT.format(message.from_user.id, message.from_user.mention)) 61 | if len(message.command) != 2: 62 | buttons = [[ 63 | InlineKeyboardButton('💝 sᴜʙsᴄʀɪʙᴇ ᴍʏ ʏᴏᴜᴛᴜʙᴇ ᴄʜᴀɴɴᴇʟ', url='https://youtube.com/@Tech_VJ') 64 | ],[ 65 | InlineKeyboardButton('🔍 sᴜᴘᴘᴏʀᴛ ɢʀᴏᴜᴘ', url='https://t.me/vj_bot_disscussion'), 66 | InlineKeyboardButton('🤖 ᴜᴘᴅᴀᴛᴇ ᴄʜᴀɴɴᴇʟ', url='https://t.me/vj_botz') 67 | ],[ 68 | InlineKeyboardButton('💁‍♀️ ʜᴇʟᴘ', callback_data='help'), 69 | InlineKeyboardButton('😊 ᴀʙᴏᴜᴛ', callback_data='about') 70 | ]] 71 | if CLONE_MODE == True: 72 | buttons.append([InlineKeyboardButton('🤖 ᴄʀᴇᴀᴛᴇ ʏᴏᴜʀ ᴏᴡɴ ᴄʟᴏɴᴇ ʙᴏᴛ', callback_data='clone')]) 73 | reply_markup = InlineKeyboardMarkup(buttons) 74 | me = client.me 75 | await message.reply_photo( 76 | photo=random.choice(PICS), 77 | caption=script.START_TXT.format(message.from_user.mention, me.mention), 78 | reply_markup=reply_markup 79 | ) 80 | return 81 | 82 | # Don't Remove Credit Tg - @VJ_Botz 83 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 84 | # Ask Doubt on telegram @KingVJ01 85 | 86 | data = message.command[1] 87 | try: 88 | pre, file_id = data.split('_', 1) 89 | except: 90 | file_id = data 91 | pre = "" 92 | if data.split("-", 1)[0] == "verify": 93 | userid = data.split("-", 2)[1] 94 | token = data.split("-", 3)[2] 95 | if str(message.from_user.id) != str(userid): 96 | return await message.reply_text( 97 | text="Invalid link or Expired link !", 98 | protect_content=True 99 | ) 100 | is_valid = await check_token(client, userid, token) 101 | if is_valid == True: 102 | await message.reply_text( 103 | text=f"Hey {message.from_user.mention}, You are successfully verified !\nNow you have unlimited access for all files till today midnight.", 104 | protect_content=True 105 | ) 106 | await verify_user(client, userid, token) 107 | else: 108 | return await message.reply_text( 109 | text="Invalid link or Expired link !", 110 | protect_content=True 111 | ) 112 | elif data.split("-", 1)[0] == "BATCH": 113 | try: 114 | if not await check_verification(client, message.from_user.id) and VERIFY_MODE == True: 115 | btn = [[ 116 | InlineKeyboardButton("Verify", url=await get_token(client, message.from_user.id, f"https://telegram.me/{username}?start=")) 117 | ],[ 118 | InlineKeyboardButton("How To Open Link & Verify", url=VERIFY_TUTORIAL) 119 | ]] 120 | await message.reply_text( 121 | text="You are not verified !\nKindly verify to continue !", 122 | protect_content=True, 123 | reply_markup=InlineKeyboardMarkup(btn) 124 | ) 125 | return 126 | except Exception as e: 127 | return await message.reply_text(f"**Error - {e}**") 128 | sts = await message.reply("**🔺 ᴘʟᴇᴀsᴇ ᴡᴀɪᴛ**") 129 | file_id = data.split("-", 1)[1] 130 | msgs = BATCH_FILES.get(file_id) 131 | if not msgs: 132 | decode_file_id = base64.urlsafe_b64decode(file_id + "=" * (-len(file_id) % 4)).decode("ascii") 133 | msg = await client.get_messages(LOG_CHANNEL, int(decode_file_id)) 134 | media = getattr(msg, msg.media.value) 135 | file_id = media.file_id 136 | file = await client.download_media(file_id) 137 | try: 138 | with open(file) as file_data: 139 | msgs=json.loads(file_data.read()) 140 | except: 141 | await sts.edit("FAILED") 142 | return await client.send_message(LOG_CHANNEL, "UNABLE TO OPEN FILE.") 143 | os.remove(file) 144 | BATCH_FILES[file_id] = msgs 145 | 146 | filesarr = [] 147 | for msg in msgs: 148 | channel_id = int(msg.get("channel_id")) 149 | msgid = msg.get("msg_id") 150 | info = await client.get_messages(channel_id, int(msgid)) 151 | if info.media: 152 | file_type = info.media 153 | file = getattr(info, file_type.value) 154 | f_caption = getattr(info, 'caption', '') 155 | if f_caption: 156 | f_caption = f_caption.html 157 | old_title = getattr(file, "file_name", "") 158 | title = formate_file_name(old_title) 159 | size=get_size(int(file.file_size)) 160 | if BATCH_FILE_CAPTION: 161 | try: 162 | f_caption=BATCH_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) 163 | except: 164 | f_caption=f_caption 165 | if f_caption is None: 166 | f_caption = f"{title}" 167 | if STREAM_MODE == True: 168 | if info.video or info.document: 169 | log_msg = info 170 | fileName = {quote_plus(get_name(log_msg))} 171 | stream = f"{URL}watch/{str(log_msg.id)}/{quote_plus(get_name(log_msg))}?hash={get_hash(log_msg)}" 172 | download = f"{URL}{str(log_msg.id)}/{quote_plus(get_name(log_msg))}?hash={get_hash(log_msg)}" 173 | button = [[ 174 | InlineKeyboardButton("• ᴅᴏᴡɴʟᴏᴀᴅ •", url=download), 175 | InlineKeyboardButton('• ᴡᴀᴛᴄʜ •', url=stream) 176 | ],[ 177 | InlineKeyboardButton("• ᴡᴀᴛᴄʜ ɪɴ ᴡᴇʙ ᴀᴘᴘ •", web_app=WebAppInfo(url=stream)) 178 | ]] 179 | reply_markup=InlineKeyboardMarkup(button) 180 | else: 181 | reply_markup = None 182 | try: 183 | msg = await info.copy(chat_id=message.from_user.id, caption=f_caption, protect_content=False, reply_markup=reply_markup) 184 | except FloodWait as e: 185 | await asyncio.sleep(e.value) 186 | msg = await info.copy(chat_id=message.from_user.id, caption=f_caption, protect_content=False, reply_markup=reply_markup) 187 | except: 188 | continue 189 | else: 190 | try: 191 | msg = await info.copy(chat_id=message.from_user.id, protect_content=False) 192 | except FloodWait as e: 193 | await asyncio.sleep(e.value) 194 | msg = await info.copy(chat_id=message.from_user.id, protect_content=False) 195 | except: 196 | continue 197 | filesarr.append(msg) 198 | await asyncio.sleep(1) 199 | await sts.delete() 200 | if AUTO_DELETE_MODE == True: 201 | k = await client.send_message(chat_id = message.from_user.id, text=f"❗️❗️❗️IMPORTANT❗️️❗️❗️\n\nThis Movie File/Video will be deleted in {AUTO_DELETE} minutes 🫥 (Due to Copyright Issues).\n\nPlease forward this File/Video to your Saved Messages and Start Download there") 202 | await asyncio.sleep(AUTO_DELETE_TIME) 203 | for x in filesarr: 204 | try: 205 | await x.delete() 206 | except: 207 | pass 208 | await k.edit_text("Your All Files/Videos is successfully deleted!!!") 209 | return 210 | 211 | # Don't Remove Credit Tg - @VJ_Botz 212 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 213 | # Ask Doubt on telegram @KingVJ01 214 | 215 | pre, decode_file_id = ((base64.urlsafe_b64decode(data + "=" * (-len(data) % 4))).decode("ascii")).split("_", 1) 216 | if not await check_verification(client, message.from_user.id) and VERIFY_MODE == True: 217 | btn = [[ 218 | InlineKeyboardButton("Verify", url=await get_token(client, message.from_user.id, f"https://telegram.me/{username}?start=")) 219 | ],[ 220 | InlineKeyboardButton("How To Open Link & Verify", url=VERIFY_TUTORIAL) 221 | ]] 222 | await message.reply_text( 223 | text="You are not verified !\nKindly verify to continue !", 224 | protect_content=True, 225 | reply_markup=InlineKeyboardMarkup(btn) 226 | ) 227 | return 228 | try: 229 | msg = await client.get_messages(LOG_CHANNEL, int(decode_file_id)) 230 | if msg.media: 231 | media = getattr(msg, msg.media.value) 232 | title = formate_file_name(media.file_name) 233 | size=get_size(media.file_size) 234 | f_caption = f"{title}" 235 | if CUSTOM_FILE_CAPTION: 236 | try: 237 | f_caption=CUSTOM_FILE_CAPTION.format(file_name= '' if title is None else title, file_size='' if size is None else size, file_caption='') 238 | except: 239 | return 240 | if STREAM_MODE == True: 241 | if msg.video or msg.document: 242 | log_msg = msg 243 | fileName = {quote_plus(get_name(log_msg))} 244 | stream = f"{URL}watch/{str(log_msg.id)}/{quote_plus(get_name(log_msg))}?hash={get_hash(log_msg)}" 245 | download = f"{URL}{str(log_msg.id)}/{quote_plus(get_name(log_msg))}?hash={get_hash(log_msg)}" 246 | button = [[ 247 | InlineKeyboardButton("• ᴅᴏᴡɴʟᴏᴀᴅ •", url=download), 248 | InlineKeyboardButton('• ᴡᴀᴛᴄʜ •', url=stream) 249 | ],[ 250 | InlineKeyboardButton("• ᴡᴀᴛᴄʜ ɪɴ ᴡᴇʙ ᴀᴘᴘ •", web_app=WebAppInfo(url=stream)) 251 | ]] 252 | reply_markup=InlineKeyboardMarkup(button) 253 | else: 254 | reply_markup = None 255 | del_msg = await msg.copy(chat_id=message.from_user.id, caption=f_caption, reply_markup=reply_markup, protect_content=False) 256 | else: 257 | del_msg = await msg.copy(chat_id=message.from_user.id, protect_content=False) 258 | if AUTO_DELETE_MODE == True: 259 | k = await client.send_message(chat_id = message.from_user.id, text=f"❗️❗️❗️IMPORTANT❗️️❗️❗️\n\nThis Movie File/Video will be deleted in {AUTO_DELETE} minutes 🫥 (Due to Copyright Issues).\n\nPlease forward this File/Video to your Saved Messages and Start Download there") 260 | await asyncio.sleep(AUTO_DELETE_TIME) 261 | try: 262 | await del_msg.delete() 263 | except: 264 | pass 265 | await k.edit_text("Your File/Video is successfully deleted!!!") 266 | return 267 | except: 268 | pass 269 | 270 | # Don't Remove Credit Tg - @VJ_Botz 271 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 272 | # Ask Doubt on telegram @KingVJ01 273 | 274 | @Client.on_message(filters.command('api') & filters.private) 275 | async def shortener_api_handler(client, m: Message): 276 | user_id = m.from_user.id 277 | user = await get_user(user_id) 278 | cmd = m.command 279 | 280 | if len(cmd) == 1: 281 | s = script.SHORTENER_API_MESSAGE.format(base_site=user["base_site"], shortener_api=user["shortener_api"]) 282 | return await m.reply(s) 283 | 284 | elif len(cmd) == 2: 285 | api = cmd[1].strip() 286 | await update_user_info(user_id, {"shortener_api": api}) 287 | await m.reply("Shortener API updated successfully to " + api) 288 | 289 | # Don't Remove Credit Tg - @VJ_Botz 290 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 291 | # Ask Doubt on telegram @KingVJ01 292 | 293 | @Client.on_message(filters.command("base_site") & filters.private) 294 | async def base_site_handler(client, m: Message): 295 | user_id = m.from_user.id 296 | user = await get_user(user_id) 297 | cmd = m.command 298 | text = f"`/base_site (base_site)`\n\nCurrent base site: None\n\n EX: `/base_site shortnerdomain.com`\n\nIf You Want To Remove Base Site Then Copy This And Send To Bot - `/base_site None`" 299 | if len(cmd) == 1: 300 | return await m.reply(text=text, disable_web_page_preview=True) 301 | elif len(cmd) == 2: 302 | base_site = cmd[1].strip() 303 | if base_site == None: 304 | await update_user_info(user_id, {"base_site": base_site}) 305 | return await m.reply("Base Site updated successfully") 306 | 307 | if not domain(base_site): 308 | return await m.reply(text=text, disable_web_page_preview=True) 309 | await update_user_info(user_id, {"base_site": base_site}) 310 | await m.reply("Base Site updated successfully") 311 | 312 | # Don't Remove Credit Tg - @VJ_Botz 313 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 314 | # Ask Doubt on telegram @KingVJ01 315 | 316 | @Client.on_callback_query() 317 | async def cb_handler(client: Client, query: CallbackQuery): 318 | if query.data == "close_data": 319 | await query.message.delete() 320 | elif query.data == "about": 321 | buttons = [[ 322 | InlineKeyboardButton('Hᴏᴍᴇ', callback_data='start'), 323 | InlineKeyboardButton('🔒 Cʟᴏsᴇ', callback_data='close_data') 324 | ]] 325 | await client.edit_message_media( 326 | query.message.chat.id, 327 | query.message.id, 328 | InputMediaPhoto(random.choice(PICS)) 329 | ) 330 | reply_markup = InlineKeyboardMarkup(buttons) 331 | me2 = (await client.get_me()).mention 332 | await query.message.edit_text( 333 | text=script.ABOUT_TXT.format(me2), 334 | reply_markup=reply_markup, 335 | parse_mode=enums.ParseMode.HTML 336 | ) 337 | 338 | # Don't Remove Credit Tg - @VJ_Botz 339 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 340 | # Ask Doubt on telegram @KingVJ01 341 | 342 | elif query.data == "start": 343 | buttons = [[ 344 | InlineKeyboardButton('💝 sᴜʙsᴄʀɪʙᴇ ᴍʏ ʏᴏᴜᴛᴜʙᴇ ᴄʜᴀɴɴᴇʟ', url='https://youtube.com/@Tech_VJ') 345 | ],[ 346 | InlineKeyboardButton('🔍 sᴜᴘᴘᴏʀᴛ ɢʀᴏᴜᴘ', url='https://t.me/vj_bot_disscussion'), 347 | InlineKeyboardButton('🤖 ᴜᴘᴅᴀᴛᴇ ᴄʜᴀɴɴᴇʟ', url='https://t.me/vj_botz') 348 | ],[ 349 | InlineKeyboardButton('💁‍♀️ ʜᴇʟᴘ', callback_data='help'), 350 | InlineKeyboardButton('😊 ᴀʙᴏᴜᴛ', callback_data='about') 351 | ]] 352 | if CLONE_MODE == True: 353 | buttons.append([InlineKeyboardButton('🤖 ᴄʀᴇᴀᴛᴇ ʏᴏᴜʀ ᴏᴡɴ ᴄʟᴏɴᴇ ʙᴏᴛ', callback_data='clone')]) 354 | reply_markup = InlineKeyboardMarkup(buttons) 355 | await client.edit_message_media( 356 | query.message.chat.id, 357 | query.message.id, 358 | InputMediaPhoto(random.choice(PICS)) 359 | ) 360 | me2 = (await client.get_me()).mention 361 | await query.message.edit_text( 362 | text=script.START_TXT.format(query.from_user.mention, me2), 363 | reply_markup=reply_markup, 364 | parse_mode=enums.ParseMode.HTML 365 | ) 366 | 367 | # Don't Remove Credit Tg - @VJ_Botz 368 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 369 | # Ask Doubt on telegram @KingVJ01 370 | 371 | elif query.data == "clone": 372 | buttons = [[ 373 | InlineKeyboardButton('Hᴏᴍᴇ', callback_data='start'), 374 | InlineKeyboardButton('🔒 Cʟᴏsᴇ', callback_data='close_data') 375 | ]] 376 | await client.edit_message_media( 377 | query.message.chat.id, 378 | query.message.id, 379 | InputMediaPhoto(random.choice(PICS)) 380 | ) 381 | reply_markup = InlineKeyboardMarkup(buttons) 382 | await query.message.edit_text( 383 | text=script.CLONE_TXT.format(query.from_user.mention), 384 | reply_markup=reply_markup, 385 | parse_mode=enums.ParseMode.HTML 386 | ) 387 | 388 | # Don't Remove Credit Tg - @VJ_Botz 389 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 390 | # Ask Doubt on telegram @KingVJ01 391 | 392 | elif query.data == "help": 393 | buttons = [[ 394 | InlineKeyboardButton('Hᴏᴍᴇ', callback_data='start'), 395 | InlineKeyboardButton('🔒 Cʟᴏsᴇ', callback_data='close_data') 396 | ]] 397 | await client.edit_message_media( 398 | query.message.chat.id, 399 | query.message.id, 400 | InputMediaPhoto(random.choice(PICS)) 401 | ) 402 | reply_markup = InlineKeyboardMarkup(buttons) 403 | await query.message.edit_text( 404 | text=script.HELP_TXT, 405 | reply_markup=reply_markup, 406 | parse_mode=enums.ParseMode.HTML 407 | ) 408 | 409 | # Don't Remove Credit Tg - @VJ_Botz 410 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 411 | # Ask Doubt on telegram @KingVJ01 412 | -------------------------------------------------------------------------------- /plugins/dbusers.py: -------------------------------------------------------------------------------- 1 | import motor.motor_asyncio 2 | from config import DB_NAME, DB_URI 3 | 4 | class Database: 5 | 6 | def __init__(self, uri, database_name): 7 | self._client = motor.motor_asyncio.AsyncIOMotorClient(uri) 8 | self.db = self._client[database_name] 9 | self.col = self.db.users 10 | 11 | def new_user(self, id, name): 12 | return dict( 13 | id = id, 14 | name = name, 15 | ) 16 | 17 | async def add_user(self, id, name): 18 | user = self.new_user(id, name) 19 | await self.col.insert_one(user) 20 | 21 | async def is_user_exist(self, id): 22 | user = await self.col.find_one({'id':int(id)}) 23 | return bool(user) 24 | 25 | async def total_users_count(self): 26 | count = await self.col.count_documents({}) 27 | return count 28 | 29 | async def get_all_users(self): 30 | return self.col.find({}) 31 | 32 | async def delete_user(self, user_id): 33 | await self.col.delete_many({'id': int(user_id)}) 34 | 35 | 36 | db = Database(DB_URI, DB_NAME) 37 | -------------------------------------------------------------------------------- /plugins/genlink.py: -------------------------------------------------------------------------------- 1 | # Don't Remove Credit @VJ_Botz 2 | # Subscribe YouTube Channel For Amazing Bot @Tech_VJ 3 | # Ask Doubt on telegram @KingVJ01 4 | 5 | import re 6 | from pyrogram import filters, Client, enums 7 | from pyrogram.errors.exceptions.bad_request_400 import ChannelInvalid, UsernameInvalid, UsernameNotModified 8 | from config import ADMINS, LOG_CHANNEL, PUBLIC_FILE_STORE, WEBSITE_URL, WEBSITE_URL_MODE 9 | from plugins.users_api import get_user, get_short_link 10 | import re 11 | import os 12 | import json 13 | import base64 14 | 15 | # Don't Remove Credit Tg - @VJ_Botz 16 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 17 | # Ask Doubt on telegram @KingVJ01 18 | 19 | async def allowed(_, __, message): 20 | if PUBLIC_FILE_STORE: 21 | return True 22 | if message.from_user and message.from_user.id in ADMINS: 23 | return True 24 | return False 25 | 26 | # Don't Remove Credit Tg - @VJ_Botz 27 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 28 | # Ask Doubt on telegram @KingVJ01 29 | 30 | @Client.on_message((filters.document | filters.video | filters.audio) & filters.private & filters.create(allowed)) 31 | async def incoming_gen_link(bot, message): 32 | username = (await bot.get_me()).username 33 | file_type = message.media 34 | post = await message.copy(LOG_CHANNEL) 35 | file_id = str(post.id) 36 | string = 'file_' 37 | string += file_id 38 | outstr = base64.urlsafe_b64encode(string.encode("ascii")).decode().strip("=") 39 | user_id = message.from_user.id 40 | user = await get_user(user_id) 41 | if WEBSITE_URL_MODE == True: 42 | share_link = f"{WEBSITE_URL}?Tech_VJ={outstr}" 43 | else: 44 | share_link = f"https://t.me/{username}?start={outstr}" 45 | if user["base_site"] and user["shortener_api"] != None: 46 | short_link = await get_short_link(user, share_link) 47 | await message.reply(f"⭕ ʜᴇʀᴇ ɪs ʏᴏᴜʀ ʟɪɴᴋ:\n\n🖇️ sʜᴏʀᴛ ʟɪɴᴋ :- {short_link}") 48 | else: 49 | await message.reply(f"⭕ ʜᴇʀᴇ ɪs ʏᴏᴜʀ ʟɪɴᴋ:\n\n🔗 ᴏʀɪɢɪɴᴀʟ ʟɪɴᴋ :- {share_link}") 50 | 51 | 52 | @Client.on_message(filters.command(['link']) & filters.create(allowed)) 53 | async def gen_link_s(bot, message): 54 | username = (await bot.get_me()).username 55 | replied = message.reply_to_message 56 | if not replied: 57 | return await message.reply('Reply to a message to get a shareable link.') 58 | # Don't Remove Credit Tg - @VJ_Botz 59 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 60 | # Ask Doubt on telegram @KingVJ01 61 | 62 | post = await replied.copy(LOG_CHANNEL) 63 | file_id = str(post.id) 64 | string = f"file_" 65 | string += file_id 66 | outstr = base64.urlsafe_b64encode(string.encode("ascii")).decode().strip("=") 67 | user_id = message.from_user.id 68 | user = await get_user(user_id) 69 | if WEBSITE_URL_MODE == True: 70 | share_link = f"{WEBSITE_URL}?Tech_VJ={outstr}" 71 | else: 72 | share_link = f"https://t.me/{username}?start={outstr}" 73 | if user["base_site"] and user["shortener_api"] != None: 74 | short_link = await get_short_link(user, share_link) 75 | await message.reply(f"⭕ ʜᴇʀᴇ ɪs ʏᴏᴜʀ ʟɪɴᴋ:\n\n🖇️ sʜᴏʀᴛ ʟɪɴᴋ :- {short_link}") 76 | else: 77 | await message.reply(f"⭕ ʜᴇʀᴇ ɪs ʏᴏᴜʀ ʟɪɴᴋ:\n\n🔗 ᴏʀɪɢɪɴᴀʟ ʟɪɴᴋ :- {share_link}") 78 | 79 | 80 | # Don't Remove Credit Tg - @VJ_Botz 81 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 82 | # Ask Doubt on telegram @KingVJ01 83 | 84 | @Client.on_message(filters.command(['batch']) & filters.create(allowed)) 85 | async def gen_link_batch(bot, message): 86 | username = (await bot.get_me()).username 87 | if " " not in message.text: 88 | return await message.reply("Use correct format.\nExample /batch https://t.me/vj_botz/10 https://t.me/vj_botz/20.") 89 | links = message.text.strip().split(" ") 90 | if len(links) != 3: 91 | return await message.reply("Use correct format.\nExample /batch https://t.me/vj_botz/10 https://t.me/vj_botz/20.") 92 | cmd, first, last = links 93 | regex = re.compile("(https://)?(t\.me/|telegram\.me/|telegram\.dog/)(c/)?(\d+|[a-zA-Z_0-9]+)/(\d+)$") 94 | match = regex.match(first) 95 | if not match: 96 | return await message.reply('Invalid link') 97 | f_chat_id = match.group(4) 98 | f_msg_id = int(match.group(5)) 99 | if f_chat_id.isnumeric(): 100 | f_chat_id = int(("-100" + f_chat_id)) 101 | 102 | # Don't Remove Credit Tg - @VJ_Botz 103 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 104 | # Ask Doubt on telegram @KingVJ01 105 | 106 | match = regex.match(last) 107 | if not match: 108 | return await message.reply('Invalid link') 109 | l_chat_id = match.group(4) 110 | l_msg_id = int(match.group(5)) 111 | if l_chat_id.isnumeric(): 112 | l_chat_id = int(("-100" + l_chat_id)) 113 | 114 | if f_chat_id != l_chat_id: 115 | return await message.reply("Chat ids not matched.") 116 | try: 117 | chat_id = (await bot.get_chat(f_chat_id)).id 118 | except ChannelInvalid: 119 | return await message.reply('This may be a private channel / group. Make me an admin over there to index the files.') 120 | except (UsernameInvalid, UsernameNotModified): 121 | return await message.reply('Invalid Link specified.') 122 | except Exception as e: 123 | return await message.reply(f'Errors - {e}') 124 | 125 | # Don't Remove Credit Tg - @VJ_Botz 126 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 127 | # Ask Doubt on telegram @KingVJ01 128 | 129 | sts = await message.reply("**ɢᴇɴᴇʀᴀᴛɪɴɢ ʟɪɴᴋ ғᴏʀ ʏᴏᴜʀ ᴍᴇssᴀɢᴇ**.\n**ᴛʜɪs ᴍᴀʏ ᴛᴀᴋᴇ ᴛɪᴍᴇ ᴅᴇᴘᴇɴᴅɪɴɢ ᴜᴘᴏɴ ɴᴜᴍʙᴇʀ ᴏғ ᴍᴇssᴀɢᴇs**") 130 | 131 | FRMT = "**ɢᴇɴᴇʀᴀᴛɪɴɢ ʟɪɴᴋ...**\n**ᴛᴏᴛᴀʟ ᴍᴇssᴀɢᴇs:** {total}\n**ᴅᴏɴᴇ:** {current}\n**ʀᴇᴍᴀɪɴɪɴɢ:** {rem}\n**sᴛᴀᴛᴜs:** {sts}" 132 | 133 | outlist = [] 134 | 135 | # Don't Remove Credit Tg - @VJ_Botz 136 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 137 | # Ask Doubt on telegram @KingVJ01 138 | 139 | # file store without db channel 140 | og_msg = 0 141 | tot = 0 142 | async for msg in bot.iter_messages(f_chat_id, l_msg_id, f_msg_id): 143 | tot += 1 144 | if og_msg % 20 == 0: 145 | try: 146 | await sts.edit(FRMT.format(total=l_msg_id-f_msg_id, current=tot, rem=((l_msg_id-f_msg_id) - tot), sts="Saving Messages")) 147 | except: 148 | pass 149 | if msg.empty or msg.service: 150 | continue 151 | file = { 152 | "channel_id": f_chat_id, 153 | "msg_id": msg.id 154 | } 155 | og_msg +=1 156 | outlist.append(file) 157 | 158 | # Don't Remove Credit Tg - @VJ_Botz 159 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 160 | # Ask Doubt on telegram @KingVJ01 161 | 162 | with open(f"batchmode_{message.from_user.id}.json", "w+") as out: 163 | json.dump(outlist, out) 164 | post = await bot.send_document(LOG_CHANNEL, f"batchmode_{message.from_user.id}.json", file_name="Batch.json", caption="⚠️ Batch Generated For Filestore.") 165 | os.remove(f"batchmode_{message.from_user.id}.json") 166 | string = str(post.id) 167 | file_id = base64.urlsafe_b64encode(string.encode("ascii")).decode().strip("=") 168 | user_id = message.from_user.id 169 | user = await get_user(user_id) 170 | if WEBSITE_URL_MODE == True: 171 | share_link = f"{WEBSITE_URL}?Tech_VJ=BATCH-{file_id}" 172 | else: 173 | share_link = f"https://t.me/{username}?start=BATCH-{file_id}" 174 | if user["base_site"] and user["shortener_api"] != None: 175 | short_link = await get_short_link(user, share_link) 176 | await sts.edit(f"⭕ ʜᴇʀᴇ ɪs ʏᴏᴜʀ ʟɪɴᴋ:\n\nContains `{og_msg}` files.\n\n🖇️ sʜᴏʀᴛ ʟɪɴᴋ :- {short_link}") 177 | else: 178 | await sts.edit(f"⭕ ʜᴇʀᴇ ɪs ʏᴏᴜʀ ʟɪɴᴋ:\n\nContains `{og_msg}` files.\n\n🔗 ᴏʀɪɢɪɴᴀʟ ʟɪɴᴋ :- {share_link}") 179 | 180 | # Don't Remove Credit Tg - @VJ_Botz 181 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 182 | # Ask Doubt on telegram @KingVJ01 183 | 184 | -------------------------------------------------------------------------------- /plugins/users_api.py: -------------------------------------------------------------------------------- 1 | # © Telegram : @KingVJ01 , GitHub : @VJBots 2 | 3 | # Don't Remove Credit Tg - @VJ_Botz 4 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 5 | # Ask Doubt on telegram @KingVJ01 6 | 7 | import requests 8 | import json 9 | from motor.motor_asyncio import AsyncIOMotorClient 10 | from plugins.clone import mongo_db 11 | 12 | # Don't Remove Credit Tg - @VJ_Botz 13 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 14 | # Ask Doubt on telegram @KingVJ01 15 | 16 | async def get_short_link(user, link): 17 | api_key = user["shortener_api"] 18 | base_site = user["base_site"] 19 | print(user) 20 | response = requests.get(f"https://{base_site}/api?api={api_key}&url={link}") 21 | data = response.json() 22 | if data["status"] == "success" or rget.status_code == 200: 23 | return data["shortenedUrl"] 24 | 25 | # Don't Remove Credit Tg - @VJ_Botz 26 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 27 | # Ask Doubt on telegram @KingVJ01 28 | 29 | async def get_user(user_id): 30 | user_id = int(user_id) 31 | user = mongo_db.user.find_one({"user_id": user_id}) 32 | if not user: 33 | res = { 34 | "user_id": user_id, 35 | "shortener_api": None, 36 | "base_site": None, 37 | } 38 | mongo_db.user.insert_one(res) 39 | user = mongo_db.user.find_one({"user_id": user_id}) 40 | return user 41 | 42 | # Don't Remove Credit Tg - @VJ_Botz 43 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 44 | # Ask Doubt on telegram @KingVJ01 45 | 46 | async def update_user_info(user_id, value:dict): 47 | user_id = int(user_id) 48 | myquery = {"user_id": user_id} 49 | newvalues = { "$set": value } 50 | mongo_db.user.update_one(myquery, newvalues) 51 | 52 | # Don't Remove Credit Tg - @VJ_Botz 53 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ 54 | # Ask Doubt on telegram @KingVJ01 55 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyrofork==2.3.45 2 | Tgcrypto 3 | asyncio 4 | aiohttp 5 | pymongo[srv]==3.12.3 6 | motor==2.5.1 7 | marshmallow==3.14.1 8 | umongo==3.0.1 9 | validators 10 | requests 11 | bs4 12 | pytz 13 | shortzy 14 | python-dotenv==0.21.1 15 | Flask==1.1.2 16 | gunicorn==20.1.0 17 | Jinja2==3.0.3 18 | werkzeug==2.0.2 19 | itsdangerous==2.0.1 20 | -------------------------------------------------------------------------------- /run cmd.txt: -------------------------------------------------------------------------------- 1 | gunicorn app:app & python3 bot.py 2 | -------------------------------------------------------------------------------- /runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.10.8 2 | -------------------------------------------------------------------------------- /utils.py: -------------------------------------------------------------------------------- 1 | import logging, asyncio, os, re, random, pytz, aiohttp, requests, string, json, http.client 2 | from datetime import date, datetime 3 | from config import SHORTLINK_API, SHORTLINK_URL 4 | from shortzy import Shortzy 5 | 6 | logger = logging.getLogger(__name__) 7 | logger.setLevel(logging.INFO) 8 | TOKENS = {} 9 | VERIFIED = {} 10 | 11 | async def get_verify_shorted_link(link): 12 | if SHORTLINK_URL == "api.shareus.io": 13 | url = f'https://{SHORTLINK_URL}/easy_api' 14 | params = { 15 | "key": SHORTLINK_API, 16 | "link": link, 17 | } 18 | try: 19 | async with aiohttp.ClientSession() as session: 20 | async with session.get(url, params=params, raise_for_status=True, ssl=False) as response: 21 | data = await response.text() 22 | return data 23 | except Exception as e: 24 | logger.error(e) 25 | return link 26 | else: 27 | # response = requests.get(f"https://{SHORTLINK_URL}/api?api={SHORTLINK_API}&url={link}") 28 | # data = response.json() 29 | # if data["status"] == "success" or rget.status_code == 200: 30 | # return data["shortenedUrl"] 31 | shortzy = Shortzy(api_key=SHORTLINK_API, base_site=SHORTLINK_URL) 32 | link = await shortzy.convert(link) 33 | return link 34 | 35 | async def check_token(bot, userid, token): 36 | user = await bot.get_users(userid) 37 | if user.id in TOKENS.keys(): 38 | TKN = TOKENS[user.id] 39 | if token in TKN.keys(): 40 | is_used = TKN[token] 41 | if is_used == True: 42 | return False 43 | else: 44 | return True 45 | else: 46 | return False 47 | 48 | async def get_token(bot, userid, link): 49 | user = await bot.get_users(userid) 50 | token = ''.join(random.choices(string.ascii_letters + string.digits, k=7)) 51 | TOKENS[user.id] = {token: False} 52 | link = f"{link}verify-{user.id}-{token}" 53 | shortened_verify_url = await get_verify_shorted_link(link) 54 | return str(shortened_verify_url) 55 | 56 | async def verify_user(bot, userid, token): 57 | user = await bot.get_users(userid) 58 | TOKENS[user.id] = {token: True} 59 | tz = pytz.timezone('Asia/Kolkata') 60 | today = date.today() 61 | VERIFIED[user.id] = str(today) 62 | 63 | async def check_verification(bot, userid): 64 | user = await bot.get_users(userid) 65 | tz = pytz.timezone('Asia/Kolkata') 66 | today = date.today() 67 | if user.id in VERIFIED.keys(): 68 | EXP = VERIFIED[user.id] 69 | years, month, day = EXP.split('-') 70 | comp = date(int(years), int(month), int(day)) 71 | if comp