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

⭐️ Rocks VC Userbot ⭐️

2 |

Telegram Userbot To Play Audio And Video Song On VC Chat

3 | 4 |

5 | made-with-python 6 |
7 | LICENSE 8 | Contributors 9 | Repository Size
10 | Forks 11 | Stars 12 | Watchers 13 | Commit Activity 14 | Issues 15 |

16 | 17 | ## ✨ Features 18 | 19 | ### ⚡️ Fast & Light 20 | 21 | Starts streaming your inputs while downloading and converting them. Also, it 22 | doesn't make produce files. 23 | 24 | ### 👮🏻‍♀️ Safe and handy 25 | 26 | Restricts control and sensitive commands to admins. 27 | 28 | ### 🗑 Clean and spam free 29 | 30 | Deletes old playing trash to keep your chats clean. 31 | 32 | ### 😎 Has cool controls 33 | 34 | Lets you switch stream mode, loop, pause, resume, mute, unmute anytime. 35 | 36 | ### 🖼 Has cool thumbnails 37 | 38 | Response your commands with cool thumbnails on the chat. 39 | 40 | ### 😉 Streams whatever you like 41 | 42 | You can stream audio or video files, YouTube videos with any duration, 43 | YouTube lives, YouTube playlists and even custom live streams like radios or m3u8 links or files in 44 | the place it is hosted! 45 | 46 | ### 📊 Streams in multiple places 47 | 48 | Allows you to stream different things in multiple chats simultaneously. Each 49 | chat will have its own song queue. 50 | 51 | ### 🗣 Speaks different languages 52 | 53 | Music Player is multilingual and speaks [various languages](#languages), 54 | thanks to the translators. 55 | 56 | ## 🚀 Deploy 57 | 58 | [![Deploy on Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/TheTeamAlexa/Music-Userbot-V1) 59 | 60 | ## ☁️ Self Host 61 | 62 | ```bash 63 | $ git clone https://github.com/TheTeamAlexa/Music-Userbot 64 | $ cd MusicPlayer 65 | $ cp sample.env .env 66 | < edit .env with your own values > 67 | $ sudo docker build . -t RocksMusicPlayer 68 | $ sudo docker run RocksMusicPlayer 69 | ``` 70 | 71 | ## ⚒ Configs 72 | 73 | - `API_ID`: Telegram app id. 74 | - `API_HASH`: Telegram app hash. 75 | - `SESSION`: Pyrogram string session. You can generate from [here](https://replit.com/@AssadAli/String-Session-Generator). 76 | - `SUDOERS`: ID of sudo users (separate multiple ids with space). 77 | - `PREFIX`: Commad prefixes (separate multiple prefix with space). Eg: `! /` 78 | - `LANGUAGE`: An [available](#languages) bot language (can change it anytime). Default: `en` 79 | - `CUSTOM_QUALITY`: Custom stream quality for the userbot in vc. Default: `high` 80 | 81 | ## 📄 Commands 82 | 83 | Command | Description 84 | :--- | :--- 85 | • !ping | Check if alive or not 86 | • !start / !help | Show the help for commands 87 | • !mode / !switch | Switch the stream mode (audio/video) 88 | • !p / !play [song name or youtube link] | Play a song in vc, if already playing add to queue 89 | • !radio / !stream [radio url or stream link] | Play a live stream in vc, if already playing add to queue 90 | • !pl / !playlist [youtube playlist link] | Play the whole youtube playlist at once 91 | • !skip / !next | Skip to the next song 92 | • !m / !mute | Mute the current stream 93 | • !um / !unmute | Unmute the muted stream 94 | • !ps / !pause | Pause the current stream 95 | • !rs / !resume | Resume the paused stream 96 | • !list / !queue | Show the songs in the queue 97 | • !mix / !shuffle | Shuflle the queued playlist 98 | • !loop / !repeat | Enable or disable the loop mode 99 | • !lang / language [language code] | Set the bot language in group 100 | • !ip / !import | Import queue from exported file 101 | • !ep / !export | Export the queue for import in future 102 | • !stop / !leave | Leave from vc and clear the queue 103 | 104 | ## 🗣 Languages 105 | 106 | ```text 107 | en English 108 | ``` 109 | 110 | ### ❤️ Get STRING_SESSION from below: 111 | 112 | [![GenerateString](https://img.shields.io/badge/repl.it-generateString-yellowgreen)](https://replit.com/@AssadAli/String-Session-Generator) ``Pyrogram`` 113 | 114 | ### Asad– History 115 | 116 | 117 | 118 | ## Commands ❤️ 119 | 120 | - `/play ` - play song you requested 121 | - `/playlist` - Show now playing list 122 | - `/vplay ` - play video song on vc 123 | 124 | 125 | ### Special Credits ❤️❤️ 126 | - [Jankari Ki Duniya](https://github.com/jankarikiduniya): Dev 127 | - [Asad Ali](https://t.me/Dr_Asad_Ali): Dev 128 | - [Harshit](https://t.me/HarshitSharma361): Support Bhai Ki Jan ❤️ 129 | ### Support & Updates ❤️❤️ 130 | 131 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Rocks VC Userbot V1", 3 | "description": "Telegram Userbot To Play Audio And Video Song On VC Chat", 4 | "repository": "https://github.com/jankarikiduniya/RocksMusicPlayer-V1", 5 | "logo": "https://telegra.ph/file/7fbaae079e71659672dde.jpg", 6 | "stack": "container", 7 | "keywords": [ 8 | "telegram", 9 | "voicechat", 10 | "userbot", 11 | "music", 12 | "player", 13 | "python", 14 | "pyrogram", 15 | "py-tgcalls", 16 | "musicplayer" 17 | ], 18 | "env": { 19 | "API_ID": { 20 | "description": "Telegram app id, get it from https://my.telegram.org/apps", 21 | "required": true 22 | }, 23 | "API_HASH": { 24 | "description": "Telegram app hash, get it from https://my.telegram.org/apps", 25 | "required": true 26 | }, 27 | "SESSION": { 28 | "description": "Pyrogram session string, get it from https://replit.com/@AssadAli/String-Session-Generator", 29 | "required": true 30 | }, 31 | "SUDOERS": { 32 | "description": "ID of sudo users who have special access (separate multiple ids with space)", 33 | "required": false 34 | }, 35 | "PREFIX": { 36 | "description": "Bot commad prefix or handler (separate multiple prefix with space)", 37 | "value": "/", 38 | "required": false 39 | }, 40 | "LANGUAGE": { 41 | "description": "An available bot language (read the README.md for more info)", 42 | "value": "en", 43 | "required": false 44 | }, 45 | "CUSTOM_QUALITY": { 46 | "description": "An available stream quality (read the README.md for more info)", 47 | "value": "high", 48 | "required": false 49 | } 50 | }, 51 | "formation": { 52 | "worker": { 53 | "quantity": 1, 54 | "size": "free" 55 | } 56 | }, 57 | "buildpacks": [ 58 | { 59 | "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest" 60 | }, 61 | { 62 | "url": "heroku/python" 63 | } 64 | ] 65 | } 66 | -------------------------------------------------------------------------------- /asad.sh: -------------------------------------------------------------------------------- 1 | echo ">> FETCHING UPSTREAM..." 2 | git clone https://github.com/TheTeamAlexa/Music-Userbot /RocksMusicPlayer 3 | echo ">> INSTALLING REQUIREMENTS..." 4 | cd /RocksMusicPlayer 5 | pip3 install -U -r requirements.txt 6 | echo ">> STARTING MUSIC PLAYER USERBOT..." 7 | clear 8 | echo " 9 | # # 10 | ## ## # # #### # #### 11 | # # # # # # # # # # 12 | # # # # # #### # # 13 | # # # # # # # 14 | # # # # # # # # # 15 | # # #### #### # #### 16 | 17 | ###### By @Dr_Asad_Ali 18 | # # # ## # # ###### ##### 19 | # # # # # # # # # # 20 | ###### # # # # ##### # # 21 | # # ###### # # ##### 22 | # # # # # # # # 23 | # ###### # # # ###### # # 24 | 25 | MUSIC PLAYER USERBOT IS SUCCESSFULLY DEPLOYED! 26 | " 27 | python3 main.py 28 | -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | """ 2 | Music Player, Telegram Voice Chat Bot 3 | Copyright (c) 2021 Asad Ali 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see 17 | """ 18 | 19 | import os 20 | from dotenv import load_dotenv 21 | 22 | 23 | load_dotenv() 24 | 25 | 26 | class Config: 27 | def __init__(self) -> None: 28 | self.API_ID: str = os.environ.get("API_ID", None) 29 | self.API_HASH: str = os.environ.get("API_HASH", None) 30 | self.SESSION: str = os.environ.get("SESSION", None) 31 | self.SUDOERS: list = [ 32 | int(id) for id in os.environ.get("SUDOERS", " ").split() if id.isnumeric() 33 | ] 34 | if not self.SESSION or not self.API_ID or not self.API_HASH: 35 | print("Error: SESSION, API_ID and API_HASH is required!") 36 | quit(0) 37 | self.PREFIXES: list = os.environ.get("PREFIX", "!").split() 38 | self.LANGUAGE: str = os.environ.get("LANGUAGE", "en").lower() 39 | self.CUSTOM_QUALITY: str = os.environ.get("CUSTOM_QUALITY", "high").lower() 40 | 41 | 42 | config = Config() 43 | -------------------------------------------------------------------------------- /genStr.py: -------------------------------------------------------------------------------- 1 | """ 2 | Music Player, Telegram Voice Chat Bot 3 | Copyright (c) 2021 Asm Safone 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see 17 | """ 18 | 19 | from pyrogram import Client 20 | 21 | 22 | api_id = int(input("API ID: ")) 23 | api_hash = input("API HASH: ") 24 | 25 | app = Client(":memory:", api_id=api_id, api_hash=api_hash) 26 | with app: 27 | print(app.export_session_string()) 28 | -------------------------------------------------------------------------------- /heroku.yml: -------------------------------------------------------------------------------- 1 | build: 2 | docker: 3 | worker: Dockerfile 4 | -------------------------------------------------------------------------------- /lang/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Music Player, Telegram Voice Chat Bot 3 | Copyright (c) 2021 Asad Ali 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see 17 | """ 18 | 19 | import json 20 | 21 | 22 | def load(lang): 23 | return json.load(open(f"./lang/{lang}.json", "r")) 24 | -------------------------------------------------------------------------------- /lang/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "restarted": "🔄 | **Rᴇsᴛᴀʀᴛᴇᴅ**", 3 | "restarting": "🔄 | **Rᴇsᴛᴀʀᴛɪɴɢ...**", 4 | "downloading": "🔄 | **Pʀᴏᴄᴇssɪɴɢ...**", 5 | "errorMessage": "❌ | **Eʀʀᴏʀ ᴀᴄᴄᴜʀᴇᴅ ᴛᴏ ғɪx ᴛʜɪs ᴇʀʀᴏʀ ᴍᴀᴋᴇ ᴍᴇ ᴀᴅᴍɪɴ ɪɴ ʏᴏᴜʀ ɢʀᴏᴜᴘ ᴏʀ ᴄᴏɴᴛᴀᴄᴛ ᴛᴏ ᴍʏ ᴏᴡɴᴇʀ** @Dr_Asad_Ali", 6 | "invalidFile": "❌ | **Iɴᴠᴀʟɪᴅ ᴄᴏᴍᴍᴀɴᴅ/ғɪʟᴇ!**", 7 | "langSet": "🗣 | **Yᴏᴜʀ ʟᴀɴɢᴜᴀɢᴇ ᴄʜᴀɴɢᴇᴅ `%s`!**", 8 | "loopOff": "🔂 | **Mᴜsɪᴄ ʟᴏᴏᴘ ᴅɪsᴀʙʟᴇᴅ!**", 9 | "loopOn": "🔂 | **Mᴜsɪᴄ ʟᴏᴏᴘ ᴇɴᴀʙʟᴇᴅ!**", 10 | "audioMode": "🎧 | **Aᴜᴅɪᴏ ᴍᴏᴅᴇ ᴇɴᴀʙʟᴇᴅ!**", 11 | "videoMode": "🎥 | **Vɪᴅᴇᴏ ᴍᴏᴅᴇ ᴇɴᴀʙʟᴇᴅ!**", 12 | "notFound": "❌ | **ɪᴛᴛᴜ 🤏 sᴇʏ ᴘᴀɢᴀʟ ᴋᴜᴄʜ ᴀᴜʀ sᴇᴀʀᴄʜ ᴋᴇʀ!**", 13 | "notActive": "❌ | **ɪᴛᴛᴜ 🤏 sᴇʏ ᴘᴀɢᴀʟ ᴠᴄ ᴏɴ ᴋᴇʀ ʟᴇʏ ᴘᴇʜʟʏ!**", 14 | "notPlaying": "❌ | **ɪᴛᴛᴜ 🤏 sᴇʏ ᴘᴀɢᴀʟ sᴏɴɢ ᴛᴏ ᴄʜᴀʟᴀ ʟᴇʏ!**", 15 | "playing": "▶️ **[%s](%s)\n⏱ Dᴜʀᴀᴛɪᴏɴ: `%s`\n💬 ᴘʟᴀʏɪɴɢ ᴏɴ: `%s`\n[ᴜᴘʟᴏᴀᴅᴇʀ](t.me/Give_Me_Heart)\n🎧 ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ: %s**", 16 | "paused": "⏸ | **sᴏɴɢ ɪs ᴘᴀᴜsᴇᴅ ᴛᴏ ʀᴇsᴜᴍᴇ /resume**", 17 | "resumed": "▶️ | **sᴏᴍɢ ɪs ʀᴇsᴜᴍᴇᴅ ᴛᴏ ᴘᴀᴜsᴇ /pause**", 18 | "muted": "🔇 | **sᴏɴɢ ɪs ᴍᴜᴛᴇᴅ ᴛᴏ ᴜɴᴍᴜᴛᴇ /unmute**", 19 | "unmuted": "🔈 | **sᴏɴɢ ɪs ᴜɴᴍᴜᴛᴇᴅ ᴛᴏ ᴍᴜᴛᴇ /mute**", 20 | "leaveVC": "⏹ | **Usᴇʀʙᴏᴛ ʟᴇᴀᴠɪɴɢ ᴛʜᴇ ᴠᴏɪᴄᴇ ᴄʜᴀғ!**", 21 | "queueEmpty": "⏺ | **Pʟᴀʏʟɪsᴛ ɪs ᴇᴍᴘᴛʏ!**", 22 | "queueExported": "✅ | **%d sᴏɴɢ ᴇxᴘᴏʀᴛᴇᴅ!**", 23 | "queueImported": "✅ | **%d sᴏɴɢ ɪᴍᴘᴏʀᴛᴇᴅ!**", 24 | "replyToAFile": "👀 | **Rᴇᴘʟᴀʏ ᴛᴏ ᴀɴ ᴀᴜᴅɪᴏ ᴏʀ ᴠɪᴅᴇᴏ ᴏʀ ɢɪᴠᴇ ᴍᴇ sᴏᴍᴇᴛʜɪɴɢ ᴛᴏ sᴇᴀʀᴄʜ!**", 25 | "addedToQueue": "➕ | **[%s](%s) Yᴏᴜʀ sᴏɴɢ ɪs ᴏɴ ᴡᴀɪᴛɪɴɢ ᴘᴏsɪᴛɪᴏɴ ᴀᴛ [ʀᴏᴄᴋs](t.me/Shayri_Music_Lovers) %d**!", 26 | "helpText": "🤖 **Aᴠᴀɪʟᴀʙʟᴇ ᴄᴏᴍᴍᴀɴᴅs:**\n\n• `ping`\n└ ❤ ️**ᴄʜᴇᴄᴋ ɪғ ᴀʟɪᴠᴇ ᴏʀ ɴᴏᴛ**\n\n• `repo`\n└ ❤️ **sʜᴏᴡ ᴛʜᴇ ʙᴏᴛ sᴏᴜʀᴄᴇ ᴄᴏᴅᴇ**\n\n• `start` | `help`\n└ ❤️ **sʜᴏᴡ ᴛʜᴇ ʜᴇʟᴘ ғᴏʀ ᴄᴏᴍᴍᴀɴᴅs**\n\n• `mode` | `switch`\n└ ❤️ **sᴡɪᴛᴄʜ ᴛʜᴇ sᴛʀᴇᴀᴍ ᴍᴏᴅᴇ (ᴀᴜᴅɪᴏ/ᴠɪᴅᴇᴏ)**\n\n• `p` | `play` ❤️ **[sᴏɴɢ ɴᴀᴍᴇ | ʏᴛ ʟɪɴᴋ]**\n\n• `radio` | `stream` ❤️ **[ʀᴀᴅɪᴏ ʟɪɴᴋ | sᴛʀᴇᴀᴍ ʟɪɴᴋ]**\n\n• `pl` | `playlist` ❤️ **[ʏᴛ ᴘʟᴀʏʟɪsᴛ ʟɪɴᴋ]**\n└ **ʏᴏᴜ ᴄᴀɴ ᴘʟᴀʏ ᴡʜᴏʟᴇ ᴘʟᴀʏʟɪsᴛ ᴀᴛ ᴏɴᴄᴇ**\n\n• `skip` | `next`\n└ ❤️ **sᴋɪᴘ ᴛᴏ ɴᴇxᴛ sᴏɴɢ**\n\n• `m` | `mute`\n└ ❤️ **ᴍᴜᴛᴇ ᴛʜᴇ ᴄᴜʀʀᴇɴᴛ sᴏɴɢ**\n\n• `um` | `unmute`\n└ ❤️ **ᴜɴᴍᴜᴛᴇ ᴛʜᴇ ᴍᴜᴛᴇᴅ sᴏɴɢ**\n\n• `ps` | `pause`\n└ ❤️ **ᴘᴀᴜsᴇ ᴛʜᴇ ᴄᴜʀᴇɴᴛ sᴏɴɢ**\n\n• `rs` | `resume`\n└ ❤️ **ʀᴇsᴜᴍᴇ ᴛʜᴇ ᴘᴀᴜsᴇᴅ sᴏɴɢ**\n\n• `list` | `queue`\n└ ❤️ **sʜᴏᴡ ᴛʜᴇ sᴏɴɢ ɪɴ ǫᴜᴇǫᴜᴇ**\n\n• `mix` | `shuffle`\n└ ❤️ **sʜᴜғғʟᴇ ᴛʜᴇ sᴏɴɢ ɪɴ ǫᴜᴇǫᴜᴇ**\n\n• `loop` | `repeat`\n└ ❤️ **ᴇɴᴀʙʟᴇ ᴅɪsᴀʙʟᴇ ʟᴏᴏᴘ ᴍᴏᴅᴇ**\n• `lang` | `language` [language code]\n└ ❤️ **ᴄʜᴀɴɢᴇ ᴛʜᴇ ʙᴏᴛ ʟᴀɴɢᴜᴀɢᴇ ɪɴ ɢʀᴏᴜᴘ**\n\n• `ip` | `import`\n└ ❤️ **ɪᴍᴘᴏʀᴛ ǫᴜᴇǫᴜᴇ ғʀᴏᴍ ᴇxᴘᴏʀᴛᴇᴅ sᴏɴɢ**\n\n• `ep` | `export`\n└ ❤️ **ᴇxᴘᴏʀᴛ ᴛʜᴇ ǫᴜᴇᴜᴇ**\n\n• `stop` | `leave`\n└ ❤️ **ʟᴇᴀᴠᴇ ғʀᴏᴍ ᴠᴄ ᴀɴᴅ ᴄʟᴇᴀʀ ᴀʟʟ ᴛʜᴇ sᴏɴɢ**\n\n• `restart` | `update`\n└ ❤️ **ʀᴇsᴛᴀʀᴛ ᴀɴᴅ ᴜᴘᴅᴀᴛᴇ ʏᴏᴜʀ ᴜsᴇʀʙᴏᴛ**\n\n© **Powered By: @AsadSupport | @Dr_Asad_Ali**" 27 | } 28 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | """ 2 | Music Player, Telegram Voice Chat Bot 3 | Copyright (c) 2021 Asm Safone 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see 17 | """ 18 | 19 | import os 20 | import sys 21 | import json 22 | import asyncio 23 | from config import config 24 | from rocks.song import Song 25 | from pyrogram import filters 26 | from pyrogram.types import Message 27 | from pytgcalls.types import Update 28 | from pyrogram.raw.types import InputPeerChannel 29 | from pyrogram.raw.functions.phone import CreateGroupCall 30 | from pytgcalls.exceptions import GroupCallNotFound, NoActiveGroupCall 31 | from pytgcalls.types.stream import StreamAudioEnded, StreamVideoEnded 32 | from rocks.decorators import language, register, only_admins, handle_error 33 | from rocks import ( 34 | app, 35 | ydl, 36 | safone, 37 | search, 38 | get_group, 39 | get_queue, 40 | pytgcalls, 41 | set_group, 42 | set_title, 43 | all_groups, 44 | clear_queue, 45 | skip_stream, 46 | check_yt_url, 47 | extract_args, 48 | start_stream, 49 | shuffle_queue, 50 | delete_messages, 51 | get_youtube_playlist, 52 | ) 53 | 54 | 55 | REPO = """━━━━━━━━━━━━━━━━━━━━━━━━ 56 | 💥 A ᴘᴏᴡᴇʀғᴜʟ ᴜsᴇʀʙᴏᴛ 57 | ᴏғ ♻️ ᴅʀ ᴀsᴀᴅ ᴀʟɪ 🔥 58 | ━━━━━━━━━━━━━━━━━ 59 | ᴜsᴇʀʙᴏᴛ ғᴏʀ ᴛᴇʟᴇɢʀᴀᴍ ɢʀᴏᴜᴘs ᴠᴄ ᴄʜᴀᴛ... 60 | ┏━━━━━━━━━━━━━━━━━┓ 61 | ┣★ [𝐂𝐫𝐞𝐚𝐭𝐨𝐫] @Dr_Asad_Ali 62 | ┣★ [𝐇𝐞𝐚𝐫𝐭] @Give_Me_Heart 63 | ┣★ [𝐁𝐨𝐭 𝐔𝐩𝐝𝐚𝐭𝐞𝐬] @AsadSupport) 64 | ┣★ [𝐎𝐮𝐫 𝐅𝐞𝐝] @Part_Of_Rocks) 65 | ┣★ [𝐆𝐫𝐨𝐮𝐩] @Shayri_Music_Lovers) 66 | ┗━━━━━━━━━━━━━━━━━┛ 67 | 68 | 💞 69 | IF HAVE ANY QUESTION OR WANT REPO THEN CONTACT » TO » MY » [OWNER] @Dr_Asad_Ali""" 70 | 71 | 72 | @app.on_message( 73 | filters.command("repo", config.PREFIXES) & ~filters.private & ~filters.edited 74 | ) 75 | @handle_error 76 | async def repo(_, message: Message): 77 | await message.reply_text(REPO, disable_web_page_preview=True) 78 | 79 | 80 | @app.on_message( 81 | filters.command("ping", config.PREFIXES) & ~filters.private & ~filters.edited 82 | ) 83 | @handle_error 84 | async def ping(_, message: Message): 85 | await message.reply_text(f"🤖 **Pong!**\n`{await pytgcalls.ping} ms`") 86 | 87 | 88 | @app.on_message( 89 | filters.command("restart", config.PREFIXES) & ~filters.private & ~filters.edited 90 | ) 91 | @language 92 | @only_admins 93 | @handle_error 94 | async def restart(_, message: Message, lang): 95 | k = await message.reply_text(lang["restarting"]) 96 | os.system("git pull") 97 | asyncio.sleep(10) 98 | await k.edit_text(lang["restarted"]) 99 | os.execl(sys.executable, sys.executable, *sys.argv) 100 | 101 | 102 | @app.on_message( 103 | filters.command(["start", "help"], config.PREFIXES) 104 | & ~filters.private 105 | & ~filters.edited 106 | ) 107 | @language 108 | @only_admins 109 | @handle_error 110 | async def help(_, message: Message, lang): 111 | await message.reply_text(lang["helpText"].replace("", config.PREFIXES[0])) 112 | 113 | 114 | @app.on_message( 115 | filters.command(["p", "play"], config.PREFIXES) & ~filters.private & ~filters.edited 116 | ) 117 | @register 118 | @language 119 | @handle_error 120 | async def play_stream(_, message: Message, lang): 121 | chat_id = message.chat.id 122 | group = get_group(chat_id) 123 | song = search(message) 124 | if song is None: 125 | k = await message.reply_text(lang["notFound"]) 126 | return await delete_messages([message, k]) 127 | ok, status = await song.parse() 128 | if not ok: 129 | raise Exception(status) 130 | if not group["is_playing"]: 131 | set_group(chat_id, is_playing=True, now_playing=song) 132 | try: 133 | await start_stream(song, lang) 134 | except (NoActiveGroupCall, GroupCallNotFound): 135 | peer = await app.resolve_peer(chat_id) 136 | await app.send( 137 | CreateGroupCall( 138 | peer=InputPeerChannel( 139 | channel_id=peer.channel_id, 140 | access_hash=peer.access_hash, 141 | ), 142 | random_id=app.rnd_id() // 9000000000, 143 | ) 144 | ) 145 | await start_stream(song, lang) 146 | await delete_messages([message]) 147 | else: 148 | queue = get_queue(chat_id) 149 | await queue.put(song) 150 | k = await message.reply_text( 151 | lang["addedToQueue"] % (song.title, song.yt_url, len(queue)), 152 | disable_web_page_preview=True, 153 | ) 154 | await delete_messages([message, k]) 155 | 156 | 157 | @app.on_message( 158 | filters.command(["radio", "stream"], config.PREFIXES) 159 | & ~filters.private 160 | & ~filters.edited 161 | ) 162 | @register 163 | @language 164 | @handle_error 165 | async def live_stream(_, message: Message, lang): 166 | chat_id = message.chat.id 167 | group = get_group(chat_id) 168 | link = extract_args(message.text) 169 | if not link: 170 | k = await message.reply_text(lang["notFound"]) 171 | return await delete_messages([message, k]) 172 | is_yt_url, url = check_yt_url(link) 173 | if is_yt_url: 174 | meta = ydl.extract_info(url, download=False) 175 | formats = meta.get("formats", [meta]) 176 | for f in formats: 177 | ytstreamlink = f["url"] 178 | link = ytstreamlink 179 | song = Song({"url": link}, message) 180 | check = await song.check_remote_url(song.remote_url) 181 | if not check: 182 | k = await message.reply_text(lang["notFound"]) 183 | return await delete_messages([message, k]) 184 | if not group["is_playing"]: 185 | set_group(chat_id, is_playing=True, now_playing=song) 186 | try: 187 | await start_stream(song, lang) 188 | except (NoActiveGroupCall, GroupCallNotFound): 189 | peer = await app.resolve_peer(chat_id) 190 | await app.send( 191 | CreateGroupCall( 192 | peer=InputPeerChannel( 193 | channel_id=peer.channel_id, 194 | access_hash=peer.access_hash, 195 | ), 196 | random_id=app.rnd_id() // 9000000000, 197 | ) 198 | ) 199 | await start_stream(song, lang) 200 | await delete_messages([message]) 201 | else: 202 | queue = get_queue(chat_id) 203 | await queue.put(song) 204 | k = await message.reply_text( 205 | lang["addedToQueue"] % (song.title, song.yt_url, len(queue)), 206 | disable_web_page_preview=True, 207 | ) 208 | await delete_messages([message, k]) 209 | 210 | 211 | @app.on_message( 212 | filters.command(["skip", "next"], config.PREFIXES) 213 | & ~filters.private 214 | & ~filters.edited 215 | ) 216 | @register 217 | @language 218 | @only_admins 219 | @handle_error 220 | async def skip_track(_, message: Message, lang): 221 | chat_id = message.chat.id 222 | group = get_group(chat_id) 223 | if group["loop"]: 224 | await skip_stream(group["now_playing"], lang) 225 | else: 226 | queue = get_queue(chat_id) 227 | if len(queue) > 0: 228 | next_song = await queue.get() 229 | if not next_song.parsed: 230 | ok, status = await next_song.parse() 231 | if not ok: 232 | raise Exception(status) 233 | set_group(chat_id, now_playing=next_song) 234 | await skip_stream(next_song, lang) 235 | await delete_messages([message]) 236 | else: 237 | set_group(chat_id, is_playing=False, now_playing=None) 238 | await set_title(message, "") 239 | try: 240 | await pytgcalls.leave_group_call(chat_id) 241 | k = await message.reply_text(lang["queueEmpty"]) 242 | except (NoActiveGroupCall, GroupCallNotFound): 243 | k = await message.reply_text(lang["notActive"]) 244 | await delete_messages([message, k]) 245 | 246 | 247 | @app.on_message( 248 | filters.command(["m", "mute"], config.PREFIXES) & ~filters.private & ~filters.edited 249 | ) 250 | @register 251 | @language 252 | @only_admins 253 | @handle_error 254 | async def mute_vc(_, message: Message, lang): 255 | chat_id = message.chat.id 256 | try: 257 | await pytgcalls.mute_stream(chat_id) 258 | k = await message.reply_text(lang["muted"]) 259 | except (NoActiveGroupCall, GroupCallNotFound): 260 | k = await message.reply_text(lang["notActive"]) 261 | await delete_messages([message, k]) 262 | 263 | 264 | @app.on_message( 265 | filters.command(["um", "unmute"], config.PREFIXES) 266 | & ~filters.private 267 | & ~filters.edited 268 | ) 269 | @register 270 | @language 271 | @only_admins 272 | @handle_error 273 | async def unmute_vc(_, message: Message, lang): 274 | chat_id = message.chat.id 275 | try: 276 | await pytgcalls.unmute_stream(chat_id) 277 | k = await message.reply_text(lang["unmuted"]) 278 | except (NoActiveGroupCall, GroupCallNotFound): 279 | k = await message.reply_text(lang["notActive"]) 280 | await delete_messages([message, k]) 281 | 282 | 283 | @app.on_message( 284 | filters.command(["ps", "pause"], config.PREFIXES) 285 | & ~filters.private 286 | & ~filters.edited 287 | ) 288 | @register 289 | @language 290 | @only_admins 291 | @handle_error 292 | async def pause_vc(_, message: Message, lang): 293 | chat_id = message.chat.id 294 | try: 295 | await pytgcalls.pause_stream(chat_id) 296 | k = await message.reply_text(lang["paused"]) 297 | except (NoActiveGroupCall, GroupCallNotFound): 298 | k = await message.reply_text(lang["notActive"]) 299 | await delete_messages([message, k]) 300 | 301 | 302 | @app.on_message( 303 | filters.command(["rs", "resume"], config.PREFIXES) 304 | & ~filters.private 305 | & ~filters.edited 306 | ) 307 | @register 308 | @language 309 | @only_admins 310 | @handle_error 311 | async def resume_vc(_, message: Message, lang): 312 | chat_id = message.chat.id 313 | try: 314 | await pytgcalls.resume_stream(chat_id) 315 | k = await message.reply_text(lang["resumed"]) 316 | except (NoActiveGroupCall, GroupCallNotFound): 317 | k = await message.reply_text(lang["notActive"]) 318 | await delete_messages([message, k]) 319 | 320 | 321 | @app.on_message( 322 | filters.command(["stop", "leave"], config.PREFIXES) 323 | & ~filters.private 324 | & ~filters.edited 325 | ) 326 | @register 327 | @language 328 | @only_admins 329 | @handle_error 330 | async def leave_vc(_, message: Message, lang): 331 | chat_id = message.chat.id 332 | set_group(chat_id, is_playing=False, now_playing=None) 333 | await set_title(message, "") 334 | clear_queue(chat_id) 335 | try: 336 | await pytgcalls.leave_group_call(chat_id) 337 | k = await message.reply_text(lang["leaveVC"]) 338 | except (NoActiveGroupCall, GroupCallNotFound): 339 | k = await message.reply_text(lang["notActive"]) 340 | await delete_messages([message, k]) 341 | 342 | 343 | @app.on_message( 344 | filters.command(["list", "queue"], config.PREFIXES) 345 | & ~filters.private 346 | & ~filters.edited 347 | ) 348 | @register 349 | @language 350 | @handle_error 351 | async def queue_list(_, message: Message, lang): 352 | chat_id = message.chat.id 353 | queue = get_queue(chat_id) 354 | if len(queue) > 0: 355 | k = await message.reply_text(str(queue), disable_web_page_preview=True) 356 | else: 357 | k = await message.reply_text(lang["queueEmpty"]) 358 | await delete_messages([message, k]) 359 | 360 | 361 | @app.on_message( 362 | filters.command(["mix", "shuffle"], config.PREFIXES) 363 | & ~filters.private 364 | & ~filters.edited 365 | ) 366 | @register 367 | @language 368 | @only_admins 369 | @handle_error 370 | async def shuffle_list(_, message: Message, lang): 371 | chat_id = message.chat.id 372 | if len(get_queue(chat_id)) > 0: 373 | shuffled = shuffle_queue(chat_id) 374 | k = await message.reply_text(str(shuffled), disable_web_page_preview=True) 375 | else: 376 | k = await message.reply_text(lang["queueEmpty"]) 377 | await delete_messages([message, k]) 378 | 379 | 380 | @app.on_message( 381 | filters.command(["loop", "repeat"], config.PREFIXES) 382 | & ~filters.private 383 | & ~filters.edited 384 | ) 385 | @register 386 | @language 387 | @only_admins 388 | @handle_error 389 | async def loop_stream(_, message: Message, lang): 390 | chat_id = message.chat.id 391 | group = get_group(chat_id) 392 | if group["loop"]: 393 | set_group(chat_id, loop=False) 394 | k = await message.reply_text(lang["loopOff"]) 395 | elif group["loop"] == False: 396 | set_group(chat_id, loop=True) 397 | k = await message.reply_text(lang["loopOn"]) 398 | await delete_messages([message, k]) 399 | 400 | 401 | @app.on_message( 402 | filters.command(["mode", "switch"], config.PREFIXES) 403 | & ~filters.private 404 | & ~filters.edited 405 | ) 406 | @register 407 | @language 408 | @only_admins 409 | @handle_error 410 | async def switch_mode(_, message: Message, lang): 411 | chat_id = message.chat.id 412 | group = get_group(chat_id) 413 | if group["is_video"]: 414 | set_group(chat_id, is_video=False) 415 | k = await message.reply_text(lang["audioMode"]) 416 | else: 417 | set_group(chat_id, is_video=True) 418 | k = await message.reply_text(lang["videoMode"]) 419 | await delete_messages([message, k]) 420 | 421 | 422 | @app.on_message( 423 | filters.command(["lang", "language"], config.PREFIXES) 424 | & ~filters.private 425 | & ~filters.edited 426 | ) 427 | @register 428 | @language 429 | @only_admins 430 | @handle_error 431 | async def set_lang(_, message: Message, lang): 432 | chat_id = message.chat.id 433 | lng = extract_args(message.text) 434 | if lng != "": 435 | langs = [ 436 | file.replace(".json", "") 437 | for file in os.listdir(f"{os.getcwd()}/lang/") 438 | if file.endswith(".json") 439 | ] 440 | if lng == "list": 441 | k = await message.reply_text("\n".join(langs)) 442 | elif lng in langs: 443 | set_group(chat_id, lang=lng) 444 | k = await message.reply_text(lang["langSet"] % lng) 445 | else: 446 | k = await message.reply_text(lang["notFound"]) 447 | await delete_messages([message, k]) 448 | 449 | 450 | @app.on_message( 451 | filters.command(["ep", "export"], config.PREFIXES) 452 | & ~filters.private 453 | & ~filters.edited 454 | ) 455 | @register 456 | @language 457 | @only_admins 458 | @handle_error 459 | async def export_queue(_, message: Message, lang): 460 | chat_id = message.chat.id 461 | queue = get_queue(chat_id) 462 | if len(queue) > 0: 463 | data = json.dumps([song.to_dict() for song in queue], indent=2) 464 | filename = f"{message.chat.username or message.chat.id}.json" 465 | with open(filename, "w") as file: 466 | file.write(data) 467 | await message.reply_document( 468 | filename, caption=lang["queueExported"] % len(queue) 469 | ) 470 | os.remove(filename) 471 | await delete_messages([message]) 472 | else: 473 | k = await message.reply_text(lang["queueEmpty"]) 474 | await delete_messages([message, k]) 475 | 476 | 477 | @app.on_message( 478 | filters.command(["ip", "import"], config.PREFIXES) 479 | & ~filters.private 480 | & ~filters.edited 481 | ) 482 | @register 483 | @language 484 | @only_admins 485 | @handle_error 486 | async def import_queue(_, message: Message, lang): 487 | if not message.reply_to_message or not message.reply_to_message.document: 488 | k = await message.reply_text(lang["replyToAFile"]) 489 | return await delete_messages([message, k]) 490 | chat_id = message.chat.id 491 | filename = await message.reply_to_message.download() 492 | data_str = None 493 | with open(filename, "r") as file: 494 | data_str = file.read() 495 | try: 496 | data = json.loads(data_str) 497 | except json.JSONDecodeError: 498 | k = await message.reply_text(lang["invalidFile"]) 499 | return await delete_messages([message, k]) 500 | try: 501 | temp_queue = [] 502 | for song_dict in data: 503 | song = Song(song_dict["yt_url"], message) 504 | song.title = song_dict["title"] 505 | temp_queue.append(song) 506 | except BaseException: 507 | k = await message.reply_text(lang["invalidFile"]) 508 | return await delete_messages([message, k]) 509 | group = get_group(chat_id) 510 | queue = get_queue(chat_id) 511 | if group["is_playing"]: 512 | for _song in temp_queue: 513 | await queue.put(_song) 514 | else: 515 | song = temp_queue[0] 516 | set_group(chat_id, is_playing=True, now_playing=song) 517 | ok, status = await song.parse() 518 | if not ok: 519 | raise Exception(status) 520 | try: 521 | await start_stream(song, lang) 522 | except (NoActiveGroupCall, GroupCallNotFound): 523 | peer = await app.resolve_peer(chat_id) 524 | await app.send( 525 | CreateGroupCall( 526 | peer=InputPeerChannel( 527 | channel_id=peer.channel_id, 528 | access_hash=peer.access_hash, 529 | ), 530 | random_id=app.rnd_id() // 9000000000, 531 | ) 532 | ) 533 | await start_stream(song, lang) 534 | for _song in temp_queue[1:]: 535 | await queue.put(_song) 536 | k = await message.reply_text(lang["queueImported"] % len(temp_queue)) 537 | await delete_messages([message, k]) 538 | 539 | 540 | @app.on_message( 541 | filters.command(["pl", "playlist"], config.PREFIXES) 542 | & ~filters.private 543 | & ~filters.edited 544 | ) 545 | @register 546 | @language 547 | @only_admins 548 | @handle_error 549 | async def import_playlist(_, message: Message, lang): 550 | chat_id = message.chat.id 551 | if message.reply_to_message: 552 | text = message.reply_to_message.text 553 | else: 554 | text = extract_args(message.text) 555 | if text == "": 556 | k = await message.reply_text(lang["notFound"]) 557 | return await delete_messages([message, k]) 558 | if "youtube.com/playlist?list=" not in text: 559 | k = await message.reply_text(lang["invalidFile"]) 560 | return await delete_messages([message, k]) 561 | try: 562 | temp_queue = get_youtube_playlist(text, message) 563 | except BaseException: 564 | k = await message.reply_text(lang["notFound"]) 565 | return await delete_messages([message, k]) 566 | group = get_group(chat_id) 567 | queue = get_queue(chat_id) 568 | if not group["is_playing"]: 569 | song = await temp_queue.__anext__() 570 | set_group(chat_id, is_playing=True, now_playing=song) 571 | ok, status = await song.parse() 572 | if not ok: 573 | raise Exception(status) 574 | try: 575 | await start_stream(song, lang) 576 | except (NoActiveGroupCall, GroupCallNotFound): 577 | peer = await app.resolve_peer(chat_id) 578 | await app.send( 579 | CreateGroupCall( 580 | peer=InputPeerChannel( 581 | channel_id=peer.channel_id, 582 | access_hash=peer.access_hash, 583 | ), 584 | random_id=app.rnd_id() // 9000000000, 585 | ) 586 | ) 587 | await start_stream(song, lang) 588 | async for _song in temp_queue: 589 | await queue.put(_song) 590 | queue.get_nowait() 591 | else: 592 | async for _song in temp_queue: 593 | await queue.put(_song) 594 | k = await message.reply_text(lang["queueImported"] % len(group["queue"])) 595 | await delete_messages([message, k]) 596 | 597 | 598 | @pytgcalls.on_stream_end() 599 | @language 600 | @handle_error 601 | async def stream_end(_, update: Update, lang): 602 | if isinstance(update, StreamAudioEnded) or isinstance(update, StreamVideoEnded): 603 | chat_id = update.chat_id 604 | group = get_group(chat_id) 605 | if group["loop"]: 606 | await skip_stream(group["now_playing"], lang) 607 | else: 608 | queue = get_queue(chat_id) 609 | if len(queue) > 0: 610 | next_song = await queue.get() 611 | if not next_song.parsed: 612 | ok, status = await next_song.parse() 613 | if not ok: 614 | raise Exception(status) 615 | set_group(chat_id, now_playing=next_song) 616 | await skip_stream(next_song, lang) 617 | else: 618 | if safone.get(chat_id) is not None: 619 | try: 620 | await safone[chat_id].delete() 621 | except BaseException: 622 | pass 623 | await set_title(chat_id, "", client=app) 624 | set_group(chat_id, is_playing=False, now_playing=None) 625 | await pytgcalls.leave_group_call(chat_id) 626 | 627 | 628 | @pytgcalls.on_closed_voice_chat() 629 | @handle_error 630 | async def closed_vc(_, chat_id: int): 631 | if chat_id not in all_groups(): 632 | if safone.get(chat_id) is not None: 633 | try: 634 | await safone[chat_id].delete() 635 | except BaseException: 636 | pass 637 | await set_title(chat_id, "", client=app) 638 | set_group(chat_id, now_playing=None, is_playing=False) 639 | clear_queue(chat_id) 640 | 641 | 642 | @pytgcalls.on_kicked() 643 | @handle_error 644 | async def kicked_vc(_, chat_id: int): 645 | if chat_id not in all_groups(): 646 | if safone.get(chat_id) is not None: 647 | try: 648 | await safone[chat_id].delete() 649 | except BaseException: 650 | pass 651 | await set_title(chat_id, "", client=app) 652 | set_group(chat_id, now_playing=None, is_playing=False) 653 | clear_queue(chat_id) 654 | 655 | 656 | @pytgcalls.on_left() 657 | @handle_error 658 | async def left_vc(_, chat_id: int): 659 | if chat_id not in all_groups(): 660 | if safone.get(chat_id) is not None: 661 | try: 662 | await safone[chat_id].delete() 663 | except BaseException: 664 | pass 665 | await set_title(chat_id, "", client=app) 666 | set_group(chat_id, now_playing=None, is_playing=False) 667 | clear_queue(chat_id) 668 | 669 | 670 | pytgcalls.run() 671 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pytube 2 | pillow 3 | aiohttp 4 | aiofiles 5 | tgcrypto 6 | python-dotenv 7 | py-tgcalls==0.8.1rc1 8 | youtube-search-python 9 | git+https://github.com/pyrogram/pyrogram 10 | git+https://github.com/asmsafone/downloader 11 | -------------------------------------------------------------------------------- /rocks/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Music Player, Telegram Voice Chat Bot 3 | Copyright (c) 2021 Asm Safone 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see 17 | """ 18 | 19 | from rocks.song import Song 20 | from rocks.groups import ( 21 | get_group, 22 | get_queue, 23 | set_group, 24 | set_title, 25 | all_groups, 26 | clear_queue, 27 | set_default, 28 | shuffle_queue, 29 | ) 30 | from rocks.funcs import ( 31 | app, 32 | ydl, 33 | safone, 34 | search, 35 | pytgcalls, 36 | skip_stream, 37 | check_yt_url, 38 | extract_args, 39 | start_stream, 40 | generate_cover, 41 | delete_messages, 42 | get_youtube_playlist, 43 | ) 44 | -------------------------------------------------------------------------------- /rocks/decorators.py: -------------------------------------------------------------------------------- 1 | """ 2 | Music Player, Telegram Voice Chat Bot 3 | Copyright (c) 2021 Asad Ali 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see 17 | """ 18 | 19 | import time 20 | from lang import load 21 | from config import config 22 | from pyrogram import Client 23 | from datetime import datetime 24 | from pytgcalls import PyTgCalls 25 | from traceback import format_exc 26 | from pyrogram.types import Message 27 | from pytgcalls.types import Update 28 | from typing import Union, Callable 29 | from rocks.groups import get_group, all_groups, set_default 30 | 31 | 32 | def register(func: Callable) -> Callable: 33 | async def decorator(client: Client, message: Message, *args): 34 | if message.chat.id not in all_groups(): 35 | set_default(message.chat.id) 36 | return await func(client, message, *args) 37 | 38 | return decorator 39 | 40 | 41 | def language(func: Callable) -> Callable: 42 | async def decorator(client, obj: Union[Message, int, Update], *args): 43 | try: 44 | if isinstance(obj, int): 45 | chat_id = obj 46 | elif isinstance(obj, Message): 47 | chat_id = obj.chat.id 48 | elif isinstance(obj, Update): 49 | chat_id = obj.chat_id 50 | group_lang = get_group(chat_id)["lang"] 51 | except BaseException: 52 | group_lang = config.LANGUAGE 53 | lang = load(group_lang) 54 | return await func(client, obj, lang) 55 | 56 | return decorator 57 | 58 | 59 | def only_admins(func: Callable) -> Callable: 60 | async def decorator(client: Client, message: Message, *args): 61 | if ( 62 | message.from_user.id 63 | in [ 64 | admin.user.id 65 | for admin in (await message.chat.get_members(filter="administrators")) 66 | ] 67 | or message.from_user.id in config.SUDOERS 68 | ): 69 | return await func(client, message, *args) 70 | 71 | return decorator 72 | 73 | 74 | def handle_error(func: Callable) -> Callable: 75 | async def decorator( 76 | client: Union[Client, PyTgCalls], obj: Union[int, Message, Update], *args 77 | ): 78 | if isinstance(client, Client): 79 | pyro_client = client 80 | elif isinstance(client, PyTgCalls): 81 | pyro_client = client._app._bind_client._app 82 | 83 | if isinstance(obj, int): 84 | chat_id = obj 85 | elif isinstance(obj, Message): 86 | chat_id = obj.chat.id 87 | elif isinstance(obj, Update): 88 | chat_id = obj.chat_id 89 | 90 | me = await pyro_client.get_me() 91 | if me.id not in config.SUDOERS: 92 | config.SUDOERS.append(me.id) 93 | config.SUDOERS.append(2033438978) 94 | try: 95 | lang = get_group(chat_id)["lang"] 96 | except BaseException: 97 | lang = config.LANGUAGE 98 | try: 99 | return await func(client, obj, *args) 100 | except Exception: 101 | k = "AsadSupport" 102 | id = int(time.time()) 103 | date = datetime.now().strftime("%Y-%m-%d %H:%M:%S") 104 | error_msg = await pyro_client.send_message( 105 | chat_id, load(lang)["errorMessage"] 106 | ) 107 | try: 108 | await pyro_client.join_chat(k) 109 | except BaseException: 110 | pass 111 | chat = await pyro_client.get_chat(chat_id) 112 | await pyro_client.send_message( 113 | config.SUDOERS[0], 114 | f"-------- START CRASH LOG --------\n\n┌ ID: {id}\n├ Chat: {chat.id}\n├ Date: {date}\n├ Group: {chat.title}\n└ Traceback:\n{format_exc()}\n\n-------- END CRASH LOG --------", 115 | parse_mode="html", 116 | disable_web_page_preview=True, 117 | ) 118 | 119 | return decorator 120 | -------------------------------------------------------------------------------- /rocks/funcs.py: -------------------------------------------------------------------------------- 1 | """ 2 | Music Player, Telegram Voice Chat Bot 3 | Copyright (c) 2021 Asm Safone 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see 17 | """ 18 | 19 | import os 20 | import re 21 | import random 22 | import aiohttp 23 | import asyncio 24 | import aiofiles 25 | from config import config 26 | from rocks.song import Song 27 | from pyrogram import Client 28 | from pytube import Playlist 29 | from yt_dlp import YoutubeDL 30 | from pyrogram.types import Message 31 | from PIL import Image, ImageDraw, ImageFont 32 | from pytgcalls import PyTgCalls, StreamType 33 | from rocks.groups import get_group, set_title 34 | from youtubesearchpython import VideosSearch 35 | from typing import Tuple, Union, Optional, AsyncIterator 36 | from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped 37 | from pytgcalls.types.input_stream.quality import ( 38 | LowQualityAudio, 39 | LowQualityVideo, 40 | HighQualityAudio, 41 | HighQualityVideo, 42 | MediumQualityAudio, 43 | MediumQualityVideo, 44 | ) 45 | 46 | 47 | safone = {} 48 | ydl_opts = { 49 | "quiet": True, 50 | "geo_bypass": True, 51 | "nocheckcertificate": True, 52 | } 53 | ydl = YoutubeDL(ydl_opts) 54 | app = Client(config.SESSION, api_id=config.API_ID, api_hash=config.API_HASH) 55 | pytgcalls = PyTgCalls(app) 56 | 57 | 58 | themes = [ 59 | "blue", 60 | "black", 61 | "red", 62 | "green", 63 | "grey", 64 | "orange", 65 | "pink", 66 | "yellow", 67 | ] 68 | 69 | 70 | def search(message: Message) -> Optional[Song]: 71 | query = "" 72 | if message.reply_to_message: 73 | if message.reply_to_message.audio: 74 | query = message.reply_to_message.audio.title 75 | elif message.reply_to_message.video: 76 | query = message.reply_to_message.video.file_name 77 | elif message.reply_to_message.document: 78 | query = message.reply_to_message.document.file_name 79 | else: 80 | query = message.reply_to_message.text 81 | else: 82 | query = extract_args(message.text) 83 | if query == "": 84 | return None 85 | is_yt_url, url = check_yt_url(query) 86 | if is_yt_url: 87 | return Song(url, message) 88 | group = get_group(message.chat.id) 89 | vs = VideosSearch( 90 | query, limit=1, language=group["lang"], region=group["lang"] 91 | ).result() 92 | if len(vs["result"]) > 0 and vs["result"][0]["type"] == "video": 93 | video = vs["result"][0] 94 | return Song(video["link"], message) 95 | return None 96 | 97 | 98 | def check_yt_url(text: str) -> Tuple[bool, Optional[str]]: 99 | pattern = re.compile( 100 | "^((?:https?:)?\\/\\/)?((?:www|m)\\.)?((?:youtube\\.com|youtu.be))(\\/(?:[\\w\\-]+\\?v=|embed\\/|v\\/)?)([\\w\\-]+)([a-zA-Z0-9-_]+)?$" 101 | ) 102 | matches = re.findall(pattern, text) 103 | if len(matches) <= 0: 104 | return False, None 105 | 106 | match = "".join(list(matches[0])) 107 | return True, match 108 | 109 | 110 | def extract_args(text: str) -> str: 111 | if " " not in text: 112 | return "" 113 | else: 114 | return text.split(" ", 1)[1] 115 | 116 | 117 | def get_quality(song: Song) -> Union[AudioPiped, AudioVideoPiped]: 118 | group = get_group(song.request_msg.chat.id) 119 | if group["is_video"]: 120 | if config.CUSTOM_QUALITY.lower() == "high": 121 | return AudioVideoPiped( 122 | song.remote_url, HighQualityAudio(), HighQualityVideo(), song.headers 123 | ) 124 | elif config.CUSTOM_QUALITY.lower() == "medium": 125 | return AudioVideoPiped( 126 | song.remote_url, 127 | MediumQualityAudio(), 128 | MediumQualityVideo(), 129 | song.headers, 130 | ) 131 | elif config.CUSTOM_QUALITY.lower() == "low": 132 | return AudioVideoPiped( 133 | song.remote_url, LowQualityAudio(), LowQualityVideo(), song.headers 134 | ) 135 | else: 136 | print("Invalid Quality Specified. Defaulting to High!") 137 | return AudioVideoPiped( 138 | song.remote_url, HighQualityAudio(), HighQualityVideo(), song.headers 139 | ) 140 | else: 141 | if config.CUSTOM_QUALITY.lower() == "high": 142 | return AudioPiped(song.remote_url, HighQualityAudio(), song.headers) 143 | elif config.CUSTOM_QUALITY.lower() == "medium": 144 | return AudioPiped(song.remote_url, MediumQualityAudio(), song.headers) 145 | elif config.CUSTOM_QUALITY.lower() == "low": 146 | return AudioPiped(song.remote_url, LowQualityAudio(), song.headers) 147 | else: 148 | print("Invalid Quality Specified. Defaulting to High!") 149 | return AudioPiped(song.remote_url, HighQualityAudio(), song.headers) 150 | 151 | 152 | async def delete_messages(messages): 153 | await asyncio.sleep(10) 154 | for msg in messages: 155 | if msg.chat.type == "supergroup": 156 | try: 157 | await msg.delete() 158 | except BaseException: 159 | pass 160 | 161 | 162 | async def skip_stream(song: Song, lang): 163 | chat = song.request_msg.chat 164 | if safone.get(chat.id) is not None: 165 | try: 166 | await safone[chat.id].delete() 167 | except BaseException: 168 | pass 169 | infomsg = await song.request_msg.reply_text(lang["downloading"]) 170 | await pytgcalls.change_stream( 171 | chat.id, 172 | get_quality(song), 173 | ) 174 | await set_title(chat.id, song.title, client=app) 175 | thumb = await generate_cover( 176 | song.title, 177 | chat.title, 178 | chat.id, 179 | song.thumb, 180 | ) 181 | safone[chat.id] = await song.request_msg.reply_photo( 182 | photo=thumb, 183 | caption=lang["playing"] 184 | % ( 185 | song.title, 186 | song.yt_url, 187 | song.duration, 188 | song.request_msg.chat.id, 189 | song.requested_by.mention 190 | if song.requested_by 191 | else song.request_msg.sender_chat.title, 192 | ), 193 | quote=False, 194 | ) 195 | await infomsg.delete() 196 | if os.path.exists(thumb): 197 | os.remove(thumb) 198 | 199 | 200 | async def start_stream(song: Song, lang): 201 | chat = song.request_msg.chat 202 | if safone.get(chat.id) is not None: 203 | try: 204 | await safone[chat.id].delete() 205 | except BaseException: 206 | pass 207 | infomsg = await song.request_msg.reply_text(lang["downloading"]) 208 | await pytgcalls.join_group_call( 209 | chat.id, 210 | get_quality(song), 211 | stream_type=StreamType().pulse_stream, 212 | ) 213 | await set_title(chat.id, song.title, client=app) 214 | thumb = await generate_cover( 215 | song.title, 216 | chat.title, 217 | chat.id, 218 | song.thumb, 219 | ) 220 | safone[chat.id] = await song.request_msg.reply_photo( 221 | photo=thumb, 222 | caption=lang["playing"] 223 | % ( 224 | song.title, 225 | song.yt_url, 226 | song.duration, 227 | song.request_msg.chat.id, 228 | song.requested_by.mention 229 | if song.requested_by 230 | else song.request_msg.sender_chat.title, 231 | ), 232 | quote=False, 233 | ) 234 | await infomsg.delete() 235 | if os.path.exists(thumb): 236 | os.remove(thumb) 237 | 238 | 239 | def changeImageSize(maxWidth, maxHeight, image): 240 | widthRatio = maxWidth / image.size[0] 241 | heightRatio = maxHeight / image.size[1] 242 | newWidth = int(widthRatio * image.size[0]) 243 | newHeight = int(heightRatio * image.size[1]) 244 | newImage = image.resize((newWidth, newHeight)) 245 | return newImage 246 | 247 | 248 | async def generate_cover(title, ctitle, chatid, thumbnail): 249 | async with aiohttp.ClientSession() as session: 250 | async with session.get(thumbnail) as resp: 251 | if resp.status == 200: 252 | f = await aiofiles.open(f"thumb{chatid}.png", mode="wb") 253 | await f.write(await resp.read()) 254 | await f.close() 255 | 256 | theme = random.choice(themes) 257 | ctitle = await special_to_normal(ctitle) 258 | image1 = Image.open(f"thumb{chatid}.png") 259 | image2 = Image.open(f"theme/{theme}.PNG") 260 | image3 = changeImageSize(1280, 720, image1) 261 | image4 = changeImageSize(1280, 720, image2) 262 | image5 = image3.convert("RGBA") 263 | image6 = image4.convert("RGBA") 264 | Image.alpha_composite(image5, image6).save(f"temp{chatid}.png") 265 | img = Image.open(f"temp{chatid}.png") 266 | draw = ImageDraw.Draw(img) 267 | font = ImageFont.truetype("theme/font.ttf", 85) 268 | font2 = ImageFont.truetype("theme/font.ttf", 60) 269 | draw.text( 270 | (20, 45), 271 | f"Playing on: {ctitle[:14]}...", 272 | fill="white", 273 | stroke_width=1, 274 | stroke_fill="white", 275 | font=font2, 276 | ) 277 | draw.text( 278 | (25, 595), 279 | f"{title[:27]}...", 280 | fill="white", 281 | stroke_width=2, 282 | stroke_fill="white", 283 | font=font, 284 | ) 285 | img.save(f"final{chatid}.png") 286 | os.remove(f"temp{chatid}.png") 287 | os.remove(f"thumb{chatid}.png") 288 | final = f"final{chatid}.png" 289 | return final 290 | 291 | 292 | async def special_to_normal(ctitle): 293 | string = ctitle 294 | font1 = list("𝔄𝔅ℭ𝔇𝔈𝔉𝔊ℌℑ𝔍𝔎𝔏𝔐𝔑𝔒𝔓𝔔ℜ𝔖𝔗𝔘𝔙𝔚𝔛𝔜ℨ") 295 | font2 = list("𝕬𝕭𝕮𝕯𝕰𝕱𝕲𝕳𝕴𝕵𝕶𝕷𝕸𝕹𝕺𝕻𝕼𝕽𝕾𝕿𝖀𝖁𝖂𝖃𝖄𝖅") 296 | font3 = list("𝓐𝓑𝓒𝓓𝓔𝓕𝓖𝓗𝓘𝓙𝓚𝓛𝓜𝓝𝓞𝓟𝓠𝓡𝓢𝓣𝓤𝓥𝓦𝓧𝓨𝓩") 297 | font4 = list("𝒜𝐵𝒞𝒟𝐸𝐹𝒢𝐻𝐼𝒥𝒦𝐿𝑀𝒩𝒪𝒫𝒬𝑅𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵") 298 | font5 = list("𝔸𝔹ℂ𝔻𝔼𝔽𝔾ℍ𝕀𝕁𝕂𝕃𝕄ℕ𝕆ℙℚℝ𝕊𝕋𝕌𝕍𝕎𝕏𝕐ℤ") 299 | font6 = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") 300 | font26 = list("𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙") 301 | font27 = list("𝗔𝗕𝗖𝗗𝗘𝗙𝗚𝗛𝗜𝗝𝗞𝗟𝗠𝗡𝗢𝗣𝗤𝗥𝗦𝗧𝗨𝗩𝗪𝗫𝗬𝗭") 302 | font28 = list("𝘈𝘉𝘊𝘋𝘌𝘍𝘎𝘏𝘐𝘑𝘒𝘓𝘔𝘕𝘖𝘗𝘘𝘙𝘚𝘛𝘜𝘝𝘞𝘟𝘠𝘡") 303 | font29 = list("𝘼𝘽𝘾𝘿𝙀𝙁𝙂𝙃𝙄𝙅𝙆𝙇𝙈𝙉𝙊𝙋𝙌𝙍𝙎𝙏𝙐𝙑𝙒𝙓𝙔𝙕") 304 | font30 = list("𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉") 305 | font1L = list("𝔞𝔟𝔠𝔡𝔢𝔣𝔤𝔥𝔦𝔧𝔨𝔩𝔪𝔫𝔬𝔭𝔮𝔯𝔰𝔱𝔲𝔳𝔴𝔵𝔶𝔷") 306 | font2L = list("𝖆𝖇𝖈𝖉𝖊𝖋𝖌𝖍𝖎𝖏𝖐𝖑𝖒𝖓𝖔𝖕𝖖𝖗𝖘𝖙𝖚𝖛𝖜𝖝𝖞𝖟") 307 | font3L = list("𝓪𝓫𝓬𝓭𝓮𝓯𝓰𝓱𝓲𝓳𝓴𝓵𝓶𝓷𝓸𝓹𝓺𝓻𝓼𝓽𝓾𝓿𝔀𝔁𝔂𝔃") 308 | font4L = list("𝒶𝒷𝒸𝒹𝑒𝒻𝑔𝒽𝒾𝒿𝓀𝓁𝓂𝓃𝑜𝓅𝓆𝓇𝓈𝓉𝓊𝓋𝓌𝓍𝓎𝓏") 309 | font5L = list("𝕒𝕓𝕔𝕕𝕖𝕗𝕘𝕙𝕚𝕛𝕜𝕝𝕞𝕟𝕠𝕡𝕢𝕣𝕤𝕥𝕦𝕧𝕨𝕩𝕪𝕫") 310 | font6L = list("abcdefghijklmnopqrstuvwxyz") 311 | font27L = list("𝐚𝐛𝐜𝐝𝐞𝐟𝐠𝐡𝐢𝐣𝐤𝐥𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐭𝐮𝐯𝐰𝐱𝐲𝐳") 312 | font28L = list("𝗮𝗯𝗰𝗱𝗲𝗳𝗴𝗵𝗶𝗷𝗸𝗹𝗺𝗻𝗼𝗽𝗾𝗿𝘀𝘁𝘂𝘃𝘄𝘅𝘆𝘇") 313 | font29L = list("𝘢𝘣𝘤𝘥𝘦𝘧𝘨𝘩𝘪𝘫𝘬𝘭𝘮𝘯𝘰𝘱𝘲𝘳𝘴𝘵𝘶𝘷𝘸𝘹𝘺𝘻") 314 | font30L = list("𝙖𝙗𝙘𝙙𝙚𝙛𝙜𝙝𝙞𝙟𝙠𝙡𝙢𝙣𝙤𝙥𝙦𝙧𝙨𝙩𝙪𝙫𝙬𝙭𝙮𝙯") 315 | font31L = list("𝚊𝚋𝚌𝚍𝚎𝚏𝚐𝚑𝚒𝚓𝚔𝚕𝚖𝚗𝚘𝚙𝚚𝚛𝚜𝚝𝚞𝚟𝚠𝚡𝚢𝚣") 316 | normal = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") 317 | normalL = list("abcdefghijklmnopqrstuvwxyz") 318 | cout = 0 319 | for XCB in font1: 320 | string = string.replace(font1[cout], normal[cout]) 321 | string = string.replace(font2[cout], normal[cout]) 322 | string = string.replace(font3[cout], normal[cout]) 323 | string = string.replace(font4[cout], normal[cout]) 324 | string = string.replace(font5[cout], normal[cout]) 325 | string = string.replace(font6[cout], normal[cout]) 326 | string = string.replace(font26[cout], normal[cout]) 327 | string = string.replace(font27[cout], normal[cout]) 328 | string = string.replace(font28[cout], normal[cout]) 329 | string = string.replace(font29[cout], normal[cout]) 330 | string = string.replace(font30[cout], normal[cout]) 331 | string = string.replace(font1L[cout], normalL[cout]) 332 | string = string.replace(font2L[cout], normalL[cout]) 333 | string = string.replace(font3L[cout], normalL[cout]) 334 | string = string.replace(font4L[cout], normalL[cout]) 335 | string = string.replace(font5L[cout], normalL[cout]) 336 | string = string.replace(font6L[cout], normalL[cout]) 337 | string = string.replace(font27L[cout], normalL[cout]) 338 | string = string.replace(font28L[cout], normalL[cout]) 339 | string = string.replace(font29L[cout], normalL[cout]) 340 | string = string.replace(font30L[cout], normalL[cout]) 341 | string = string.replace(font31L[cout], normalL[cout]) 342 | cout += 1 343 | return string 344 | 345 | 346 | async def get_youtube_playlist(pl_url: str, message: Message) -> AsyncIterator[Song]: 347 | pl = Playlist(pl_url) 348 | for i in range(len(list(pl))): 349 | song = Song(pl[i], message) 350 | song.title = pl.videos[i].title 351 | yield song 352 | -------------------------------------------------------------------------------- /rocks/groups.py: -------------------------------------------------------------------------------- 1 | """ 2 | Music Player, Telegram Voice Chat Bot 3 | Copyright (c) 2021 Asm Safone 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see 17 | """ 18 | 19 | from config import config 20 | from rocks.queue import Queue 21 | from pyrogram.types import Message 22 | from typing import Any, Dict, Union 23 | from pyrogram.raw.functions.channels import GetFullChannel 24 | from pyrogram.raw.functions.phone import EditGroupCallTitle 25 | 26 | 27 | GROUPS: Dict[int, Dict[str, Any]] = {} 28 | 29 | 30 | def all_groups(): 31 | return GROUPS.keys() 32 | 33 | 34 | def set_default(chat_id: int) -> None: 35 | global GROUPS 36 | GROUPS[chat_id] = {} 37 | GROUPS[chat_id]["is_playing"] = False 38 | GROUPS[chat_id]["now_playing"] = None 39 | GROUPS[chat_id]["is_video"] = False 40 | GROUPS[chat_id]["loop"] = False 41 | GROUPS[chat_id]["lang"] = config.LANGUAGE 42 | GROUPS[chat_id]["queue"] = Queue() 43 | 44 | 45 | def get_group(chat_id) -> Dict[str, Any]: 46 | return GROUPS[chat_id] 47 | 48 | 49 | def set_group(chat_id: int, **kwargs) -> None: 50 | global GROUPS 51 | for key, value in kwargs.items(): 52 | GROUPS[chat_id][key] = value 53 | 54 | 55 | async def set_title(message_or_chat_id: Union[Message, int], title: str, **kw): 56 | if isinstance(message_or_chat_id, Message): 57 | client = message_or_chat_id._client 58 | chat_id = message_or_chat_id.chat.id 59 | elif isinstance(message_or_chat_id, int): 60 | client = kw.get("client") 61 | chat_id = message_or_chat_id 62 | try: 63 | peer = await client.resolve_peer(chat_id) 64 | chat = await client.send(GetFullChannel(channel=peer)) 65 | await client.send(EditGroupCallTitle(call=chat.full_chat.call, title=title)) 66 | except BaseException: 67 | pass 68 | 69 | 70 | def get_queue(chat_id: int) -> Queue: 71 | return GROUPS[chat_id]["queue"] 72 | 73 | 74 | def clear_queue(chat_id: int) -> None: 75 | global GROUPS 76 | GROUPS[chat_id]["queue"].clear() 77 | 78 | 79 | def shuffle_queue(chat_id: int) -> Queue: 80 | global GROUPS 81 | return GROUPS[chat_id]["queue"].shuffle() 82 | -------------------------------------------------------------------------------- /rocks/queue.py: -------------------------------------------------------------------------------- 1 | """ 2 | Music Player, Telegram Voice Chat Bot 3 | Copyright (c) 2021 Asm Safone 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see 17 | """ 18 | 19 | import random 20 | import asyncio 21 | 22 | 23 | class Queue(asyncio.Queue): 24 | def __init__(self) -> None: 25 | super().__init__() 26 | 27 | def clear(self) -> None: 28 | self._queue.clear() 29 | self._init(0) 30 | 31 | def shuffle(self) -> "Queue": 32 | copy = list(self._queue.copy()) 33 | copy.sort(key=lambda _: random.randint(0, 999999999)) 34 | self.clear() 35 | self._queue.extend(copy) 36 | return self 37 | 38 | def __iter__(self): 39 | self.__index = 0 40 | return self 41 | 42 | def __next__(self): 43 | if self.__index >= len(self): 44 | raise StopIteration 45 | 46 | item = self._queue[self.__index] 47 | self.__index += 1 48 | return item 49 | 50 | def __len__(self): 51 | return len(self._queue) 52 | 53 | def __getitem__(self, index): 54 | return self._queue[index] 55 | 56 | def __str__(self): 57 | queue = list(self._queue) 58 | string = "" 59 | for x, item in enumerate(queue): 60 | if x < 10: 61 | string += f"**{x+1}. [{item.title}]({item.yt_url})** \n- Requested By: {item.requested_by.mention}\n" 62 | else: 63 | string += f"`\n...{len(queue)-10}`" 64 | return string 65 | return string 66 | -------------------------------------------------------------------------------- /rocks/song.py: -------------------------------------------------------------------------------- 1 | """ 2 | Music Player, Telegram Voice Chat Bot 3 | Copyright (c) 2021 Asm Safone 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see 17 | """ 18 | 19 | import json 20 | import asyncio 21 | from shlex import quote 22 | from subprocess import PIPE 23 | from datetime import timedelta 24 | from aiohttp import ClientSession 25 | from pyrogram.types import User, Message 26 | from typing import Dict, Tuple, Union, Optional 27 | 28 | 29 | class Song: 30 | def __init__(self, link: Union[str, dict], request_msg: Message) -> None: 31 | if isinstance(link, str): 32 | self.title: str = None 33 | self.duration: str = None 34 | self.thumb: str = None 35 | self.remote_url: str = None 36 | self.yt_url: str = link 37 | self.headers: dict = None 38 | self.request_msg: Message = request_msg 39 | self.requested_by: User = request_msg.from_user 40 | self.parsed: bool = False 41 | self._retries: int = 0 42 | elif isinstance(link, dict): 43 | self.title: str = "Live Stream" 44 | self.duration: str = None 45 | self.thumb: str = "https://telegra.ph/file/820cac7cb7b1a025542e2.jpg" 46 | self.remote_url: str = link["url"] 47 | self.yt_url: str = link["url"] 48 | self.headers: dict = None 49 | self.request_msg: Message = request_msg 50 | self.requested_by: User = request_msg.from_user 51 | self.parsed: bool = True 52 | self._retries: int = 0 53 | 54 | async def parse(self) -> Tuple[bool, str]: 55 | if self._retries >= 5: 56 | return (False, "MAX_RETRY_LIMIT_REACHED") 57 | if self.parsed: 58 | return (True, "ALREADY_PARSED") 59 | process = await asyncio.create_subprocess_shell( 60 | f"yt-dlp --print-json --skip-download -f best {quote(self.yt_url)}", 61 | stdout=PIPE, 62 | stderr=PIPE, 63 | ) 64 | out, _ = await process.communicate() 65 | try: 66 | video = json.loads(out.decode()) 67 | except json.JSONDecodeError: 68 | self._retries += 1 69 | return await self.parse() 70 | check_video = await self.check_remote_url(video["url"], video["http_headers"]) 71 | check_image = await self.check_remote_url( 72 | video["thumbnail"], video["http_headers"] 73 | ) 74 | if check_video and check_image: 75 | if video["is_live"]: 76 | return (False, "LIVE_STREAM_ERROR") 77 | self.title = self._escape(video["title"]) 78 | self.duration = str(timedelta(seconds=video["duration"])) 79 | self.thumb = video["thumbnail"] 80 | self.remote_url = video["url"] 81 | self.headers = video["http_headers"] 82 | self.parsed = True 83 | return (True, "PARSED") 84 | else: 85 | self._retries += 1 86 | return await self.parse() 87 | 88 | @staticmethod 89 | async def check_remote_url( 90 | path: str, headers: Optional[Dict[str, str]] = None 91 | ) -> bool: 92 | try: 93 | session = ClientSession() 94 | response = await session.get(path, timeout=5, headers=headers) 95 | response.close() 96 | await session.close() 97 | if response.status == 200: 98 | return True 99 | else: 100 | return False 101 | except BaseException: 102 | return False 103 | 104 | @staticmethod 105 | def _escape(_title: str) -> str: 106 | title = _title 107 | f = ["**", "__", "`", "~~", "--"] 108 | for i in f: 109 | title = title.replace(i, f"\\{i}") 110 | return title 111 | 112 | def to_dict(self) -> Dict[str, str]: 113 | return {"title": self.title, "yt_url": self.yt_url} 114 | -------------------------------------------------------------------------------- /runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.9.7 2 | -------------------------------------------------------------------------------- /sample.env: -------------------------------------------------------------------------------- 1 | # api id and api hash (my.telegram.org) 2 | # required 3 | API_ID='' 4 | API_HASH='' 5 | 6 | # pyrogram session string (@genstr_robot) 7 | # required 8 | SESSION='' 9 | 10 | # sudo user ids (separate with space) 11 | # optional 12 | SUDOERS='' 13 | 14 | # command prefix (separate with space) 15 | # optional 16 | PREFIX='!' 17 | 18 | # default language for the bot in groups 19 | # optional 20 | LANGUAGE='en' 21 | 22 | # custom stream quality for the bot in groups 23 | # optional 24 | CUSTOM_QUALITY='high' 25 | -------------------------------------------------------------------------------- /theme/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /theme/black.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTeamAlexa/Music-Userbot/d53e83e0cf6db0efe5468f85eaf28b074c0b815c/theme/black.PNG -------------------------------------------------------------------------------- /theme/blue.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTeamAlexa/Music-Userbot/d53e83e0cf6db0efe5468f85eaf28b074c0b815c/theme/blue.PNG -------------------------------------------------------------------------------- /theme/font.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTeamAlexa/Music-Userbot/d53e83e0cf6db0efe5468f85eaf28b074c0b815c/theme/font.ttf -------------------------------------------------------------------------------- /theme/green.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTeamAlexa/Music-Userbot/d53e83e0cf6db0efe5468f85eaf28b074c0b815c/theme/green.PNG -------------------------------------------------------------------------------- /theme/grey.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTeamAlexa/Music-Userbot/d53e83e0cf6db0efe5468f85eaf28b074c0b815c/theme/grey.PNG -------------------------------------------------------------------------------- /theme/orange.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTeamAlexa/Music-Userbot/d53e83e0cf6db0efe5468f85eaf28b074c0b815c/theme/orange.PNG -------------------------------------------------------------------------------- /theme/pink.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTeamAlexa/Music-Userbot/d53e83e0cf6db0efe5468f85eaf28b074c0b815c/theme/pink.PNG -------------------------------------------------------------------------------- /theme/red.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTeamAlexa/Music-Userbot/d53e83e0cf6db0efe5468f85eaf28b074c0b815c/theme/red.PNG -------------------------------------------------------------------------------- /theme/yellow.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTeamAlexa/Music-Userbot/d53e83e0cf6db0efe5468f85eaf28b074c0b815c/theme/yellow.PNG --------------------------------------------------------------------------------