diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..37a66e9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.10.8-slim-buster + +RUN apt update && apt upgrade -y +RUN apt install git -y +COPY requirements.txt /requirements.txt + +RUN cd / +RUN pip3 install -U pip && pip3 install -U -r requirements.txt +RUN mkdir /ForwardBot +WORKDIR /ForwardBot +RUN python3 bot.py diff --git a/LICENSE b/LICENSE index d159169..89e08fb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,339 +1,339 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..5c1d509 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: python3 bot.py diff --git a/README.md b/README.md index fdc4dae..7dc7b02 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,30 @@ # File-Forward-Bot -File-Forward-Bot +#Not Yet Completed ! +
Deploy To Render +
+ +Use these commands: +
+
+• Build Command: pip3 install -U -r requirements.txt +
+
+• Start Command: python3 bot.py +
+
+Go to https://uptimerobot.com/ and add a monitor to keep your bot alive. +
+
+Use these settings when adding a monitor:
+
+
+render template +
+
+Click on the below button to deploy directly to render ↓ +
+
+ +Deploy to Render + +
diff --git a/app.json b/app.json new file mode 100644 index 0000000..6b0793b --- /dev/null +++ b/app.json @@ -0,0 +1,57 @@ +{ + "name": "File-Forward-Bot", + "description": "Use this bot to forward all files from one channel to other even if its private or public.", + "stack": "container", + "keywords": [ + "telegram", + "auto-forward-bot", + "forward-bot", + "forward", + "best", + "indian", + "pyrogram", + "media", + "export", + "channel", + "file-forward", + "media-forward" + ], + "website": "https://github.com/Joelkb/File-Forward-Bot", + "repository": "https://github.com/Joelkb/File-Forward-Bot", + "env": { + "BOT_TOKEN": { + "description": "Your bot token.", + "required": true + }, + "API_ID": { + "description": "Get this value from https://my.telegram.org", + "required": true + }, + "API_HASH": { + "description": "Get this value from https://my.telegram.org", + "required": true + }, + "TARGET_DB": { + "description": "ID of channel which you want the bot to send all files to.", + "required": true + }, + "ADMINS": { + "description": "ID of Admin. Separate multiple Admins by space.", + "required": true + }, + "LOG_CHANNEL": { + "description": "Bot Logs,Give a channel id with -100xxxxxxx", + "required": true + } + }, + "addons": [], + "buildpacks": [{ + "url": "heroku/python" + }], + "formation": { + "worker": { + "quantity": 1, + "size": "eco" + } + } +} diff --git a/bot.py b/bot.py new file mode 100644 index 0000000..cef3ced --- /dev/null +++ b/bot.py @@ -0,0 +1,97 @@ +from pyrogram import Client, __version__ +from pyrogram.raw.all import layer +from datetime import date, datetime +from vars import SESSION, API_HASH, API_ID, BOT_TOKEN, LOG_CHANNEL, PORT +from typing import Union, Optional, AsyncGenerator +from script import scripts +from pyrogram import types +from utils import temp_utils +from aiohttp import web +from plugins import web_server +import logging +import pytz +import logging.config + +#Get logging configuration +logging.config.fileConfig('logging.conf') +logging.getLogger().setLevel(logging.INFO) +logging.getLogger("pyrogram").setLevel(logging.ERROR) + + +class Bot(Client): + + def __init__(self): + super().__init__( + name=SESSION, + api_id=API_ID, + api_hash=API_HASH, + bot_token=BOT_TOKEN, + workers=50, + plugins={"root": "plugins"}, + sleep_threshold=5, + ) + + async def start(self): + await super().start() + me = await self.get_me() + temp_utils.ME = me.id + temp_utils.USER_NAME = me.username + temp_utils.BOT_NAME = me.first_name + self.username = '@' + me.username + logging.info(f"{me.first_name} with for Pyrogram v{__version__} (Layer {layer}) started on {me.username}.") + tz = pytz.timezone('Asia/Kolkata') + today = date.today() + now = datetime.now(tz) + time = now.strftime("%H:%M:%S %p") + await self.send_message(chat_id=LOG_CHANNEL, text=scripts.RESTART_TXT.format(today, time)) + app = web.AppRunner(await web_server()) + await app.setup() + bind_address = "0.0.0.0" + await web.TCPSite(app, bind_address, PORT).start() + + async def stop(self, *args): + await super().stop() + logging.info("Bot stopped. Bye.") + + async def iter_messages( + self, + chat_id: Union[int, str], + limit: int, + offset: int = 0, + ) -> Optional[AsyncGenerator["types.Message", None]]: + """Iterate through a chat sequentially. + This convenience method does the same as repeatedly calling :meth:`~pyrogram.Client.get_messages` in a loop, thus saving + you from the hassle of setting up boilerplate code. It is useful for getting the whole chat messages with a + single call. + Parameters: + chat_id (``int`` | ``str``): + Unique identifier (int) or username (str) of the target chat. + For your personal cloud (Saved Messages) you can simply use "me" or "self". + For a contact that exists in your Telegram address book you can use his phone number (str). + + limit (``int``): + Identifier of the last message to be returned. + + offset (``int``, *optional*): + Identifier of the first message to be returned. + Defaults to 0. + Returns: + ``Generator``: A generator yielding :obj:`~pyrogram.types.Message` objects. + Example: + .. code-block:: python + for message in app.iter_messages("pyrogram", 1, 15000): + print(message.text) + """ + current = offset + while True: + new_diff = min(200, limit - current) + if new_diff <= 0: + return + messages = await self.get_messages(chat_id, list(range(current, current+new_diff+1))) + for message in messages: + yield message + current += 1 + + +app = Bot() +app.run() \ No newline at end of file diff --git a/heroku.yml b/heroku.yml new file mode 100644 index 0000000..96d0a77 --- /dev/null +++ b/heroku.yml @@ -0,0 +1,3 @@ +build: + docker: + worker: Dockerfile \ No newline at end of file diff --git a/logging.conf b/logging.conf new file mode 100644 index 0000000..a3bb28e --- /dev/null +++ b/logging.conf @@ -0,0 +1,32 @@ +[loggers] +keys=root + +[handlers] +keys=consoleHandler,fileHandler + +[formatters] +keys=consoleFormatter,fileFormatter + +[logger_root] +level=DEBUG +handlers=consoleHandler,fileHandler + +[handler_consoleHandler] +class=StreamHandler +level=INFO +formatter=consoleFormatter +args=(sys.stdout,) + +[handler_fileHandler] +class=FileHandler +level=ERROR +formatter=fileFormatter +args=('Logs.txt','w',) + +[formatter_consoleFormatter] +format=%(asctime)s - %(lineno)d - %(name)s - %(module)s - %(levelname)s - %(message)s +datefmt=%I:%M:%S %p + +[formatter_fileFormatter] +format=[%(asctime)s:%(name)s:%(lineno)d:%(levelname)s] %(message)s +datefmt=%m/%d/%Y %I:%M:%S %p \ No newline at end of file diff --git a/plugins/__init__.py b/plugins/__init__.py new file mode 100644 index 0000000..280f615 --- /dev/null +++ b/plugins/__init__.py @@ -0,0 +1,8 @@ +from aiohttp import web +from .route import routes + + +async def web_server(): + web_app = web.Application(client_max_size=30000000) + web_app.add_routes(routes) + return web_app diff --git a/plugins/callbacks.py b/plugins/callbacks.py new file mode 100644 index 0000000..89e3677 --- /dev/null +++ b/plugins/callbacks.py @@ -0,0 +1,63 @@ +from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup +from pyrogram import Client +from script import scripts +from utils import temp_utils +import logging +from .commands import start_forward + +logger = logging.getLogger(__name__) +logger.setLevel(logging.ERROR) + +@Client.on_callback_query() +async def query_handler(bot: Client, query: CallbackQuery): + if query.data == "close": + await query.message.delete() + elif query.data == "about": + btn = [[ + InlineKeyboardButton("Go Back", callback_data="home"), + InlineKeyboardButton("Close", callback_data="close") + ]] + await query.message.edit_text( + text=scripts.ABOUT_TXT.format(temp_utils.BOT_NAME), + disable_web_page_preview=True, + reply_markup=InlineKeyboardMarkup(btn) + ) + elif query.data == "home": + btn = [[ + InlineKeyboardButton("About", callback_data="about"), + InlineKeyboardButton("Souce Code", callback_data="source") + ],[ + InlineKeyboardButton("Close", callback_data="close"), + InlineKeyboardButton("Help", callback_data="help") + ]] + await query.message.edit_text( + text=scripts.START_TXT.format(query.from_user.mention, temp_utils.USER_NAME, temp_utils.BOT_NAME), + disable_web_page_preview=True, + reply_markup=InlineKeyboardMarkup(btn) + ) + elif query.data == "source": + btn = [[ + InlineKeyboardButton("Go Back", callback_data="home"), + InlineKeyboardButton("Close", callback_data="close") + ]] + await query.message.edit_text( + text=scripts.SOURCE_TXT, + disable_web_page_preview=True, + reply_markup=InlineKeyboardMarkup(btn) + ) + elif query.data == "cancel_forward": + temp_utils.CANCEL = True + elif query.data == "help": + btn = [[ + InlineKeyboardButton("Go Back", callback_data="home"), + InlineKeyboardButton("Close", callback_data="close") + ]] + await query.message.edit_text( + text=scripts.HELP_TXT.format(temp_utils.BOT_NAME), + disable_web_page_preview=True, + reply_markup=InlineKeyboardMarkup(btn) + ) + elif query.data.startswith("forward"): + ident, source_chat_id, last_msg_id = query.data.split("#") + await query.message.delete() + await start_forward(bot, query.from_user.id, source_chat_id, last_msg_id) diff --git a/plugins/commands.py b/plugins/commands.py new file mode 100644 index 0000000..0db1161 --- /dev/null +++ b/plugins/commands.py @@ -0,0 +1,185 @@ +from utils import temp_utils +from pyrogram import Client, filters, enums +from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup +from pyrogram.errors.exceptions.bad_request_400 import ChannelInvalid, UsernameInvalid, UsernameNotModified +from pyrogram.errors import FloodWait +from script import scripts +from vars import ADMINS, TARGET_DB +import asyncio +import re +import logging +logger = logging.getLogger(__name__) +logger.setLevel(logging.INFO) +lock = asyncio.Lock() + +@Client.on_message(filters.command("start")) +async def start_message(bot, message): + btn = [[ + InlineKeyboardButton("About", callback_data="about"), + InlineKeyboardButton("Souce Code", callback_data="source") + ],[ + InlineKeyboardButton("Close", callback_data="close"), + InlineKeyboardButton("Help", callback_data="help") + ]] + await message.reply_text( + text=scripts.START_TXT.format(message.from_user.mention, temp_utils.USER_NAME, temp_utils.BOT_NAME), + disable_web_page_preview=True, + reply_markup=InlineKeyboardMarkup(btn) + ) + + +@Client.on_message((filters.forwarded | (filters.regex("(https://)?(t\.me/|telegram\.me/|telegram\.dog/)(c/)?(\d+|[a-zA-Z_0-9]+)/(\d+)$")) & filters.text ) & filters.private & filters.incoming) +async def forward_cmd(bot, message): + if message.from_user.id not in ADMINS: return # admin only + if message.text: + regex = re.compile("(https://)?(t\.me/|telegram\.me/|telegram\.dog/)(c/)?(\d+|[a-zA-Z_0-9]+)/(\d+)$") + match = regex.match(message.text) + if not match: + return await message.reply('Invalid link') + source_chat_id = match.group(4) + last_msg_id = int(match.group(5)) + if source_chat_id.isnumeric(): + source_chat_id = int(("-100" + source_chat_id)) + elif message.forward_from_chat.type == enums.ChatType.CHANNEL: + last_msg_id = message.forward_from_message_id + source_chat_id = message.forward_from_chat.username or message.forward_from_chat.id + else: + return + try: + await bot.get_chat(source_chat_id) + except ChannelInvalid: + return await message.reply('This may be a private channel / group. Make me an admin over there to index the files.') + except (UsernameInvalid, UsernameNotModified): + return await message.reply('Invalid Link specified.') + except Exception as e: + logger.exception(e) + return await message.reply(f'Errors - {e}') + try: + k = await bot.get_messages(source_chat_id, last_msg_id) + except: + return await message.reply('Make Sure That Iam An Admin In The Channel, if channel is private') + if k.empty: + return await message.reply('This may be group and iam not a admin of the group.') + if lock.locked(): + return await message.reply_text('Wait until previous process complete.') + button = [[ + InlineKeyboardButton("YES", callback_data=f"forward#{source_chat_id}#{last_msg_id}") + ],[ + InlineKeyboardButton("NO", callback_data="close") + ]] + await message.reply_text( + text="Do you want to start forwarding ?", + reply_markup=InlineKeyboardMarkup(button) + ) + + +@Client.on_message(filters.command('logs') & filters.user(ADMINS)) +async def log_file(bot, message): + """Send log file""" + try: + await message.reply_document('Logs.txt') + except Exception as e: + await message.reply(str(e)) + + +@Client.on_message(filters.command('setskip') & filters.user(ADMINS)) +async def skip_msgs(bot, message): + if ' ' in message.text: + _, skip = message.text.split(" ") + try: + skip = int(skip) + except: + return await message.reply("Skip number should be an integer.") + await message.reply(f"Successfully set SKIP number as {skip}") + temp_utils.CURRENT = int(skip) + else: + await message.reply("Give me a skip number") + + +async def start_forward(bot, userid, source_chat_id, last_msg_id): + btn = [[ + InlineKeyboardButton("CANCEL", callback_data="cancel_forward") + ]] + active_msg = await bot.send_message( + chat_id=int(userid), + text="Starting Forward Process...", + reply_markup = InlineKeyboardMarkup(btn) + ) + skipped = int(temp_utils.CURRENT) + total = 0 + forwarded = 0 + empty = 0 + notmedia = 0 + unsupported = 0 + left = 0 + status = 'Idle' + async with lock: + try: + btn = [[ + InlineKeyboardButton("CANCEL", callback_data="cancel_forward") + ]] + status = 'Forwarding...' + await active_msg.edit( + text=f"Forwarding on progress...\n\nTotal: {total}\nSkipped: {skipped}\nForwarded: {forwarded}\nEmpty Message: {empty}\nNot Media: {notmedia}\nUnsupported Media: {unsupported}\nMessages Left: {left}\n\nStatus: {status}", + reply_markup=InlineKeyboardMarkup(btn) + ) + current = temp_utils.CURRENT + temp_utils.CANCEL = False + async for msg in bot.iter_messages(source_chat_id, int(last_msg_id), int(temp_utils.CURRENT)): + if temp_utils.CANCEL: + status = 'Cancelled !' + await active_msg.edit(f"Successfully Cancelled!\n\nTotal: {total}\nSkipped: {skipped}\nForwarded: {forwarded}\nEmpty Message: {empty}\nNot Media: {notmedia}\nUnsupported Media: {unsupported}\nMessages Left: {left}\n\nStatus: {status}") + break + left = int(last_msg_id)-int(total) + total = current + current += 1 + if current % 20 == 0: + btn = [[ + InlineKeyboardButton("CANCEL", callback_data="cancel_forward") + ]] + status = 'Sleeping for 30 seconds.' + await active_msg.edit( + text=f"Forwarding on progress...\n\nTotal: {total}\nSkipped: {skipped}\nForwarded: {forwarded}\nEmpty Message: {empty}\nNot Media: {notmedia}\nUnsupported Media: {unsupported}\nMessages Left: {left}\n\nStatus: {status}", + reply_markup=InlineKeyboardMarkup(btn) + ) + await asyncio.sleep(30) + status = 'Forwarding...' + await active_msg.edit( + text=f"Forwarding on progress...\n\nTotal: {total}\nSkipped: {skipped}\nForwarded: {forwarded}\nEmpty Message: {empty}\nNot Media: {notmedia}\nUnsupported Media: {unsupported}\nMessages Left: {left}\n\nStatus: {status}", + reply_markup=InlineKeyboardMarkup(btn) + ) + if msg.empty: + empty+=1 + continue + elif not msg.media: + notmedia += 1 + continue + elif msg.media not in [enums.MessageMediaType.VIDEO, enums.MessageMediaType.AUDIO, enums.MessageMediaType.DOCUMENT]: + unsupported += 1 + continue + try: + await msg.copy( + chat_id=int(TARGET_DB) + ) + forwarded+=1 + await asyncio.sleep(1) + except FloodWait as e: + btn = [[ + InlineKeyboardButton("CANCEL", callback_data="cancel_forward") + ]] + await active_msg.edit( + text=f"Got FloodWait.\n\nWaiting for {e.value} seconds.", + reply_markup=InlineKeyboardMarkup(btn) + ) + await asyncio.sleep(e.value) + await msg.copy( + chat_id=int(TARGET_DB) + ) + forwarded+=1 + continue + status = 'Completed !' + except Exception as e: + logger.exception(e) + await active_msg.edit(f'Error: {e}') + else: + await active_msg.edit(f"Successfully Completed Forward Process !\n\nTotal: {total}\nSkipped: {skipped}\nForwarded: {forwarded}\nEmpty Message: {empty}\nNot Media: {notmedia}\nUnsupported Media: {unsupported}\nMessages Left: {left}\n\nStatus: {status}") diff --git a/plugins/route.py b/plugins/route.py new file mode 100644 index 0000000..9dc87d3 --- /dev/null +++ b/plugins/route.py @@ -0,0 +1,7 @@ +from aiohttp import web + +routes = web.RouteTableDef() + +@routes.get("/", allow_head=True) +async def root_route_handler(request): + return web.json_response("DQTheFileDonor") diff --git a/render.yaml b/render.yaml new file mode 100644 index 0000000..cff376c --- /dev/null +++ b/render.yaml @@ -0,0 +1,15 @@ +services: + # A Docker web service + - type: web + name: File-Forward-Bot + env: python + startCommand: python3 bot.py + buildCommand: pip3 install -U -r requirements.txt + repo: https://github.com/Joelkb/File-Forward-Bot.git # optional + region: oregon # optional (defaults to oregon) + plan: free # optional (defaults to starter) + branch: web # optional (defaults to master) + numInstances: 1 # optional (defaults to 1) + healthCheckPath: / + +#End of yaml diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..842cd19 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +pyrogram +tgcrypto +pytz +aiohttp +datetime \ No newline at end of file diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 0000000..684075a --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +python-3.10.9 diff --git a/script.py b/script.py new file mode 100644 index 0000000..dd4d193 --- /dev/null +++ b/script.py @@ -0,0 +1,34 @@ +class scripts(object): + RESTART_TXT = """ +Bᴏᴛ Rᴇsᴛᴀʀᴛᴇᴅ ! + +📅 Dᴀᴛᴇ : {} +⏰ Tɪᴍᴇ : {} +🌐 Tɪᴍᴇᴢᴏɴᴇ : Asia/Kolkata +🛠️ Bᴜɪʟᴅ Sᴛᴀᴛᴜs: v2.7.1 [ Sᴛᴀʙʟᴇ ]""" + + START_TXT = """ +Hᴇʟʟᴏ {}, +Mʏ Nᴀᴍᴇ Is {}, I'm Just A Private Forward Bot Made By Jᴏᴇʟ ᠰ TɢX.""" + + ABOUT_TXT = """ +✯ Mʏ Nᴀᴍᴇ: {} +✯ Cʀᴇᴀᴛᴏʀ: Jᴏᴇʟ ᠰ TɢX +✯ Lɪʙʀᴀʀʏ: Pʏʀᴏɢʀᴀᴍ +✯ Lᴀɴɢᴜᴀɢᴇ: Pʏᴛʜᴏɴ 3 +✯ Bᴜɪʟᴅ Sᴛᴀᴛᴜs: v1.0.1 [ Sᴛᴀʙʟᴇ ]""" + + SOURCE_TXT = """ +ɴᴏᴛᴇ: +- ᴛʜɪꜱ ʙᴏᴛ ɪꜱ ᴀɴ ᴏᴘᴇɴ ꜱᴏᴜʀᴄᴇ ᴘʀᴏᴊᴇᴄᴛ. +- ꜱᴏᴜʀᴄᴇ - ʜᴇʀᴇ +Dᴇᴠᴇʟᴏᴘᴇʀ: +- Jᴏᴇʟ ᠰ TɢX""" + + HELP_TXT = """ +Here are all my commands: +/start - To check if I'm alive or not +/logs - To check my logs [Admin Only] +/setskip - To skip a number of messages [Admin Only] + +This bot might be available to all in the future.""" \ No newline at end of file diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..233cc33 --- /dev/null +++ b/start.sh @@ -0,0 +1,12 @@ +if [ -z $UPSTREAM_REPO ] +then + echo "Cloning main Repository" + git clone https://github.com/Joelkb/File-Forward-Bot.git /Forward +else + echo "Cloning Custom Repo from $UPSTREAM_REPO " + git clone $UPSTREAM_REPO /Forward +fi +cd /Forward +pip3 install -U -r requirements.txt +echo "Starting DQ-The-File-Donor...." +python3 bot.py diff --git a/utils.py b/utils.py new file mode 100644 index 0000000..cf0a03b --- /dev/null +++ b/utils.py @@ -0,0 +1,8 @@ +import os + +class temp_utils(object): + USER_NAME = None + BOT_NAME = None + ME = None + CURRENT = int(os.environ.get("SKIP", 0)) + CANCEL = False \ No newline at end of file diff --git a/vars.py b/vars.py new file mode 100644 index 0000000..8b9c02f --- /dev/null +++ b/vars.py @@ -0,0 +1,21 @@ +from os import environ +import re + +id_pattern = re.compile(r'^.\d+$') +def is_enabled(value, default): + if value.lower() in ["true", "yes", "1", "enable", "y"]: + return True + elif value.lower() in ["false", "no", "0", "disable", "n"]: + return False + else: + return default + +SESSION = environ.get("SESSION", "forward bot") +API_ID = int(environ["API_ID"]) +API_HASH = environ["API_HASH"] +BOT_TOKEN = environ["BOT_TOKEN"] +LOG_CHANNEL = int(environ.get("LOG_CHANNEL", 0)) +PORT = int(environ.get("PORT", "8080")) +ADMINS = [int(admin) if id_pattern.search(admin) else admin for admin in environ.get('ADMINS', '').split()] +TARGET_DB = int(environ.get("TARGET_DB", 0)) +UPSTREAM_REPO = environ.get("UPSTREAM_REPO", "https://github.com/Joelkb/File-Forward-Bot")