├── .gitignore
├── .gitmodules
├── .travis.yml
├── LICENSE
├── README.md
├── bot
├── bot.lua
├── permissions.lua
└── utils.lua
├── config_fix.sh
├── data
├── .gitkeep
└── photos
│ └── text
├── etc
└── telegram.conf
├── lang
├── arabic_lang.lua
├── catalan_lang.lua
├── english_lang.lua
├── galician_lang.lua
├── italian_lang.lua
├── persian_lang.lua
├── portuguese_lang.lua
└── spanish_lang.lua
├── launch.sh
├── libs
├── JSON.lua
├── mimetype.lua
└── redis.lua
├── patches
└── disable-python-and-libjansson.patch
├── plugins
├── arabic.lua
├── bot.lua
├── commands.lua
├── export_gban.lua
├── giverank.lua
├── id.lua
├── links.lua
├── moderation.lua
├── plugins.lua
├── rules.lua
├── settings.lua
├── spam.lua
├── version.lua
└── welcome.lua
├── start.sh
└── steady.sh
/.gitignore:
--------------------------------------------------------------------------------
1 | res/
2 | data/
3 | .luarocks
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "tg"]
2 | path = tg
3 | url = https://github.com/Josepdal/tg.git
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: erlang
2 |
3 | before_install:
4 | - sudo apt-get update -qq
5 | - sudo apt-get install -qq libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev make unzip git libjansson-dev python2.7-dev
6 | - ./launch.sh install
7 |
8 | script:
9 | - luac -p bot/*.lua
10 | - luac -p plugins/*.lua
11 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) 2015 Yago Pérez
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | DBTeamV2 is OUT
2 | ===============
3 | New tg-cli, working in all supergroups
4 | --------------------------------------
5 | https://github.com/Josepdal/DBTeamV2
6 |
7 | -----------------
8 | -----------------
9 | -----------------
10 | -----------------
11 | -----------------
12 | -----------------
13 | -----------------
14 | -----------------
15 | -----------------
16 | -----------------
17 | -----------------
18 | -----------------
19 | -----------------
20 |
21 | If you are not interested in tg-cli particular options like invite, del_msg, create groups...
22 |
23 | We recommend to you use this API Bot written in lua: https://github.com/RememberTheAir/GroupButler from a very good friend.
24 |
25 | DBTeam-bot
26 | ============
27 |
28 | A Telegram Bot based on plugins using [tg](https://github.com/vysheng/tg).
29 |
30 | Bot Commands
31 | ------------
32 |
33 |
34 |
35 |
Name
36 |
Description
37 |
38 |
39 |
40 |
41 |
bot.lua
42 |
Plugin to manage channels. Enable or disable channel.
43 |
44 |
45 |
commands.lua
46 |
Plugin to get info about what the bot can do.
47 |
48 |
49 |
(language)_lang.lua
50 |
Plugin to install a language in your redis db.
51 |
52 |
53 |
export_gban.lua
54 |
Plugin to export an installer (gban_installer.lua) or a list of all your bot gbans.
55 |
56 |
57 |
giverank.lua
58 |
Plugin to manage ranks (admins, mods and guests).
59 |
60 |
61 |
id.lua
62 |
Plugin to get info about telegram accounts.
63 |
64 |
65 |
moderation.lua
66 |
Plugin to manage users from chats. Kick, add, ban, unban, gban, ungban, kickme all of this with action by reply, by id and by username.
67 |
68 |
69 |
plugins.lua
70 |
Plugin to manage other plugins. Enable, disable or reload.
71 |
72 |
73 |
rules.lua
74 |
Plugin to get chat rules.
75 |
76 |
77 |
settings.lua
78 |
Plugin to administrate a group/supergroup, you can disable photos, stickers, gifs, links, arabic, flood, spam, lock channel members, audios...
79 |
80 |
81 |
spam.lua
82 |
Plugin to manage spam at groups and supergroups. When someone write a Telegram link to another group or channel, automatically (for example), plugin delete that user from the channel, and delete his message. Then, send a report to all sudo users in a private message with user info, text message and the name and id of that channel.
83 |
84 |
85 |
version.lua
86 |
Shows bot version
87 |
88 |
89 |
90 |
91 | #Commands Usages
92 |
93 |
94 |
95 |
Plugin
96 |
Usage
97 |
98 |
99 |
100 |
101 |
bot.lua
102 |
#bot on: enable bot in current channel.
103 | #bot off: disable bot in current channel.
104 |
105 |
106 |
commands.lua
107 |
#commands: Show all commands for every plugin.
108 | #commands [plugin]: Commands for that plugin.
109 |
110 |
111 |
112 |
export_gban.lua
113 |
#gbans installer: Return a lua file installer to share gbans and add those in another bot in just one command.
114 | #gbans list: Return an archive with a list of gbans.
115 |
116 |
117 |
118 |
gban_installer.lua
119 |
#install gbans: add a list of gbans into your redis db.
120 |
121 |
122 |
123 |
giverank.lua
124 |
#rank admin (reply): add admin by reply.
125 | #rank admin /: add admin by user ID/Username.
126 | #rank mod (reply): add mod by reply.
127 | #rank mod /: add mod by user ID/Username.
128 | #rank guest (reply): remove admin by reply.
129 | #rank guest /: remove admin by user ID/Username.
130 | #admins: list of all admin members.
131 | #mods: list of all mod members.
132 | #members: list of all channel members.
133 |
134 |
135 |
136 |
id.lua
137 |
#id: Return your ID and the chat id if you are in one.
138 | #ids chat: Return the IDs of the current chat members.
139 | #ids channel: Return the IDs of the current channel members.
140 | #id : Return the member username ID from the current chat.
141 | #whois /: Return username.
142 | #whois (reply): Return user id.
143 |
144 |
145 |
146 |
rules.lua
147 |
#rules: shows chat rules you set before or send default rules.
148 | #setrules : set chat rules.
149 | #remrules: remove chat rules and return to default ones.
150 |
151 |
152 |
moderation.lua
153 |
#add: replying to a message, the user will be added to the current group/supergroup.
154 | #add /: adds a user by its ID/Username to the current group/supergroup.
155 | #kick: replying to a message, the user will be kicked in the current group/supergroup.
156 | #kick /: the user will be kicked by its ID/Username in the current group/supergroup.
157 | #kickme: kick yourself.
158 | #ban: replying to a message, the user will be kicked and banned in the current group/supergroup.
159 | #ban /: the user will be banned by its ID/Username in the current group/supergroup and it wont be able to return.
160 | #unban: replying to a message, the user will be unbanned in the current group/supergroup.
161 | #unban /: the user will be unbanned by its ID/Username in the current group/supergroup.
162 | #gban: replying to a message, the user will be kicked and banned from all groups/supergroups.
163 | #gban /: the user will be banned by its ID/Username from all groups/supergroups and it wont be able to enter.
164 | #ungban: replying to a message, the user will be unbanned from all groups/supergroups.
165 | #ungban /: the user will be unbanned by its ID/Username from all groups/supergroups.
166 | #mute: replying to a message, the user will be silenced in the current supergroup, erasing all its messages.
167 | #mute /: the user will be silenced by its ID/Username inthe current supergroup, erasing all its messages.
168 | #unmute: replying to a message, the user will be unsilenced in the current supergroup.
169 | #unmute /: the user will be unsilenced by its ID/Username in the current supergroup.
170 | #rem: replying to a message, the message will be removed.
171 |
172 |
173 |
174 |
settings.lua
175 |
#settings stickers enable/disable: when enabled, all stickers will be cleared.
176 | #settings links enable/disable: when enabled, all links will be cleared.
177 | #settings arabic enable/disable: when enabled, all messages with arabic/persian will be cleared.
178 | #settings bots enable/disable: when enabled, if someone adds a bot, it will be kicked.
179 | #settings gifs enable/disable: when enabled, all gifs will be cleared.
180 | #settings photos enable/disable: when enabled, all photos will be cleared.
181 | #settings audios enable/disable: when enabled, all audios will be cleared.
182 | #settings kickme enable/disable: when enabled, people can kick out itself.
183 | #settings spam enable/disable: when enabled, all spam links will be cleared.
184 | #settings setphoto enable/disable: when enabled, if a user changes the group photo, the bot will revert to the saved photo.
185 | #settings setname enable/disable: when enabled, if a user changes the group name, the bot will revert to the saved name.
186 | #settings lockmember enable/disable: when enabled, the bot will kick all people that enters to the group.
187 | #settings floodtime : set the time that bot uses to check flood.
188 | #settings maxflood : set the maximum messages in a floodtime to be considered as flood.
189 | #setname : the bot will change group title.
190 | #setphoto : the bot will change group photo.
191 | #lang : it changes the language of the bot.
192 | #setlink : saves the link of the group.
193 | #link: to get the link of the group.
194 | #muteall: mute all chat members.
195 | #muteall : mute all chat members for time.
196 | #unmuteall: remove mute restriction.
197 | #creategroup: create a group with your bot in a command.
198 | #tosupergroup: upgrade your chat to a channel.
199 | #setdescription: change your channel description.
200 |
201 |
202 |
203 |
plugins.lua
204 |
#plugins: shows a list of all plugins.
205 | #plugins / [plugin]: enable/disable the specified plugin.
206 | plugins / [plugin] chat: enable/disable the specified plugin, only in the current group/supergroup.
207 | #plugins reload: reloads all plugins.
208 |
209 |
210 |
211 |
version.lua
212 |
#version: shows bot version.
213 |
214 |
215 |
216 |
217 | [Installation](https://github.com/yagop/telegram-bot/wiki/Installation)
218 | ------------
219 | ```bash
220 | # Tested on Ubuntu 14.04, for other OSs check out https://github.com/yagop/telegram-bot/wiki/Installation
221 | sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev make unzip git redis-server g++ libjansson-dev libpython-dev expat libexpat1-dev tmux subversion
222 | ```
223 |
224 | ```bash
225 | # After those dependencies, lets install the bot
226 | cd $HOME #Do not write this if you are using c9 or not root accounts
227 | git clone https://github.com/Josepdal/DBTeam.git
228 | cd DBTeam
229 | ./launch.sh install
230 | ./launch.sh # Will ask you for a phone number & confirmation code.
231 | ```
232 | You can also use this command to install the bot in just one step.
233 | ```bash
234 | sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev make unzip git redis-server g++ libjansson-dev libpython-dev expat libexpat1-dev tmux subversion -y && cd $HOME && rm -rf DBTeam && rm -rf .telegram-cli && git clone https://github.com/Josepdal/DBTeam.git && cd DBTeam && ./launch.sh install && ./launch.sh
235 | ```
236 | Then, you have to install a bot language like this:
237 | ```
238 | #install english_lang
239 | #lang en
240 | ```
241 |
242 | Enable more [`plugins`](https://github.com/yagop/Talibot/tree/supergroups/plugins)
243 | -------------
244 | See the plugins list with `#plugins` command.
245 |
246 | Enable a disabled plugin by `#plugins enable [name]`.
247 |
248 | Disable an enabled plugin by `#plugins disable [name]`.
249 |
250 | Those commands require a privileged user, privileged users are defined inside `data/config.lua` (generated by the bot), stop the bot and edit if necessary.
251 |
252 |
253 | Keep the bot always running
254 | ------------
255 | If your bot stops sometimes due to crashes or freezes in telegram-cli, and you want to keep it running all the time
256 | you can start the bot this way. Note that it only will be recovering the bot if the problem is a telegram-cli issue,
257 | it won't recover of vps hibernation or system problems.
258 |
259 | You need to have [`tmux`](https://github.com/tmux/tmux) or [`screen`](https://www.gnu.org/software/screen) installed.
260 | Both are pre installed in almost all linux distributions, but in case you don't you can get it this way: `sudo apt-get install tmux screen`
261 | Tmux and screen are two different terminal multiplexer programs that will be needed in order to use the script.
262 |
263 | You can use __`steady.sh`__ script in two ways: with `tmux`_(recomended)_ or with `screen`. You may also mix them, but it is not assured to work.
264 |
265 | ####Using tmux
266 | To start the script with tmux, just run this command in your Bot folder:
267 | ```bash
268 | tmux new-session -s script "bash steady.sh -t"
269 | ```
270 | Where `tmux` is the terminal multiplexer, `new-session -s` means that we want to open a tmux session with a name, `script` is the name of that session and with `"bash steady.sh -t"` we are launching _steady.sh_ with the argument `-t` (tmux mode).
271 | The script will launch and it will show you if there is any error.
272 |
273 |
274 | The bot will be running in the background even if SSH session closes. You can just detach (get out) the tmux session by typing _Control+b_ and _d_
275 |
276 |
277 | If you want to get inside the script session again, type: `tmux attach-session -t script`
278 | If you want to get into Bot session (reading the messages), write: `tmux attach-session -t DBTeam`
279 |
280 |
281 | You can stop the script by pressing _Control+C_ in the script session. Alternatively, you can `tmux kill-session -t script` or also killing all tmux processes `killall tmux`. Remember that you can exit without closing the session with _Control+b_ and _d_.
282 |
283 |
284 | ####Using screen
285 | Firstly kill all the telegram-cli and screen processes running on your vps:
286 | ```bash
287 | killall screen
288 | killall telegram-cli
289 | ```
290 | Then you have to launch the script (you need to be in DBTeam folder):
291 | ```bash
292 | screen bash steady.sh -s
293 | ```
294 |
295 | Now you can close the SSH session and it will be running in the background. You can also just detach the screen by typing _Control+a_ and _Control+d_
296 |
297 | If you want to get inside the session again, type:
298 | `screen -x`
299 | You will be shown a message saying "_There are several suitable screens on:_" and two lines similar to this ones:
300 | ```
301 | 12345.xxxxxxx (Date) (Detached)
302 | 67890.pts.xxx (Date) (Detached)
303 | ```
304 | If you write: `screen -x 12345` (the number above), you will be in the telegram session of the bot reading the messages.
305 | Writing: `screen -x 67890` (the number below), you will be in the script screen. Remember that you can go back with _Control+a_ and _Control+d_.
306 |
307 |
308 |
309 | To stop all the processes related to the bot and the script, type:
310 | ```
311 | killall screen
312 | killall tmux
313 | killall telegram-cli
314 | ```
315 |
316 |
317 |
318 |
319 |
320 |
321 | Bot status is checked every 10 seconds (default) and printed on the screen. You can change this value editing the script ($RELOADTIME).
322 |
323 | The script has __more usages__, like starting sessions detached. Type `bash steady.sh -h` to see all the commands and information about the script.
324 |
325 | It is also possible to use __steady.sh__ for other bots. You only need to change $BOT variable. This can be usefull to have more bots in the same server _(this feature is only avaliable in tmux mode)_
326 |
327 |
328 |
329 | Run it as a daemon
330 | ------------
331 | If your Linux/Unix comes with [upstart](http://upstart.ubuntu.com/) you can run the bot by this way
332 | ```bash
333 | $ sed -i "s/yourusername/$(whoami)/g" etc/telegram.conf
334 | $ sed -i "s_telegrambotpath_$(pwd)_g" etc/telegram.conf
335 | $ sudo cp etc/telegram.conf /etc/init/
336 | $ sudo start telegram # To start it
337 | $ sudo stop telegram # To stop it
338 | ```
339 |
340 | DBTeam support and development groups
341 | -------------------------------------
342 |
343 | [](https://telegram.me/joinchat/C142CD3GT-26EFdxu_lW0g) [](https://telegram.me/joinchat/C142CD5wPizyWWg4R3TJLw) [](https://telegram.me/joinchat/BbkmWz2Ozu7EakNpixOJ5A)
344 |
345 | DBTeam developers
346 | -----------------
347 |
348 | [](https://telegram.me/Josepdal) [](https://telegram.me/MaSkAoS)
349 |
350 | Yagop developer and bot development group
351 | -----------------------------------------
352 |
353 | [](https://telegram.me/Yago_Perez) [](https://telegram.me/joinchat/ALJ3izwBCNXSswCHOKMwGw) [](https://gitter.im/yagop/telegram-bot])
354 |
355 | Other interesting sites
356 | -----------------------
357 |
358 | [](https://www.icrc.org/ "Donate to Red Cross Society") [](http://taligram.org)
359 |
360 | Contact us
361 | ------------
362 | You can contact us in groups said before but if you have an issue please [open](https://github.com/Josepdal/DBTeam/issues) one.
363 |
--------------------------------------------------------------------------------
/bot/bot.lua:
--------------------------------------------------------------------------------
1 | package.path = package.path .. ';.luarocks/share/lua/5.2/?.lua'
2 | ..';.luarocks/share/lua/5.2/?/init.lua'
3 | package.cpath = package.cpath .. ';.luarocks/lib/lua/5.2/?.so'
4 |
5 | require("./bot/utils")
6 | require("./bot/permissions")
7 |
8 | local f = assert(io.popen('/usr/bin/git describe --tags', 'r'))
9 | VERSION = assert(f:read('*a'))
10 | f:close()
11 |
12 | -- This function is called when tg receive a msg
13 | function on_msg_receive (msg)
14 | if not started then
15 | return
16 | end
17 |
18 | msg = backward_msg_format(msg)
19 |
20 | local receiver = get_receiver(msg)
21 |
22 | -- vardump(msg)
23 | msg = pre_process_service_msg(msg)
24 | if msg_valid(msg) then
25 | msg = pre_process_msg(msg)
26 | if msg then
27 | match_plugins(msg)
28 | mark_read(receiver, ok_cb, false)
29 | end
30 | end
31 | end
32 |
33 | function ok_cb(extra, success, result)
34 | end
35 |
36 | function on_binlog_replay_end()
37 | started = true
38 | postpone (cron_plugins, false, 60*5.0)
39 | -- See plugins/isup.lua as an example for cron
40 |
41 | _config = load_config()
42 |
43 | _gbans = load_gbans()
44 |
45 | -- load plugins
46 | plugins = {}
47 | load_plugins()
48 |
49 | -- load language
50 | lang = {}
51 | load_lang()
52 | end
53 |
54 | function msg_valid(msg)
55 | -- Don't process outgoing messages
56 | if msg.out then
57 | print('\27[36mNot valid: msg from us\27[39m')
58 | return false
59 | end
60 |
61 | -- Before bot was started
62 | if msg.date < now then
63 | print('\27[36mNot valid: old msg\27[39m')
64 | return false
65 | end
66 |
67 | if msg.unread == 0 then
68 | print('\27[36mNot valid: readed\27[39m')
69 | return false
70 | end
71 |
72 | if not msg.to.id then
73 | print('\27[36mNot valid: To id not provided\27[39m')
74 | return false
75 | end
76 |
77 | if not msg.from.id then
78 | print('\27[36mNot valid: From id not provided\27[39m')
79 | return false
80 | end
81 |
82 | if msg.from.id == our_id then
83 | print('\27[36mNot valid: Msg from our id\27[39m')
84 | return false
85 | end
86 |
87 | if msg.to.type == 'encr_chat' then
88 | print('\27[36mNot valid: Encrypted chat\27[39m')
89 | return false
90 | end
91 |
92 | if msg.from.id == 777000 then
93 | print('\27[36mNot valid: Telegram message\27[39m')
94 | return false
95 | end
96 |
97 | return true
98 | end
99 |
100 | --
101 | function pre_process_service_msg(msg)
102 | if msg.service then
103 | local action = msg.action or {type=""}
104 | -- Double ! to discriminate of normal actions
105 | msg.text = "!!tgservice " .. action.type
106 |
107 | -- wipe the data to allow the bot to read service messages
108 | if msg.out then
109 | msg.out = false
110 | end
111 | if msg.from.id == our_id then
112 | msg.from.id = 0
113 | end
114 | end
115 | return msg
116 | end
117 |
118 | -- Apply plugin.pre_process function
119 | function pre_process_msg(msg)
120 | for name,plugin in pairs(plugins) do
121 | if plugin.pre_process and msg then
122 | print('Preprocess', name)
123 | msg = plugin.pre_process(msg)
124 | end
125 | end
126 |
127 | return msg
128 | end
129 |
130 | -- Go over enabled plugins patterns.
131 | function match_plugins(msg)
132 | for name, plugin in pairs(plugins) do
133 | match_plugin(plugin, name, msg)
134 | end
135 | end
136 |
137 | -- Check if plugin is on _config.disabled_plugin_on_chat table
138 | local function is_plugin_disabled_on_chat(plugin_name, receiver)
139 | local disabled_chats = _config.disabled_plugin_on_chat
140 | -- Table exists and chat has disabled plugins
141 | if disabled_chats and disabled_chats[receiver] then
142 | -- Checks if plugin is disabled on this chat
143 | for disabled_plugin,disabled in pairs(disabled_chats[receiver]) do
144 | if disabled_plugin == plugin_name and disabled then
145 | local warning = 'Plugin '..disabled_plugin..' is disabled on this chat'
146 | print(warning)
147 | send_msg(receiver, warning, ok_cb, false)
148 | return true
149 | end
150 | end
151 | end
152 | return false
153 | end
154 |
155 | function match_plugin(plugin, plugin_name, msg)
156 | local receiver = get_receiver(msg)
157 |
158 | -- Go over patterns. If one matches it's enough.
159 | for k, pattern in pairs(plugin.patterns) do
160 | local matches = match_pattern(pattern, msg.text)
161 | if matches then
162 | print("msg matches: ", pattern)
163 |
164 | if is_plugin_disabled_on_chat(plugin_name, receiver) then
165 | return nil
166 | end
167 | -- Function exists
168 | if plugin.run then
169 | -- If plugin is for privileged users only
170 | if not warns_user_not_allowed(plugin, msg) then
171 | local result = plugin.run(msg, matches)
172 | if result then
173 | send_large_msg(receiver, result)
174 | end
175 | end
176 | end
177 | -- One patterns matches
178 | return
179 | end
180 | end
181 | end
182 |
183 | -- DEPRECATED, use send_large_msg(destination, text)
184 | function _send_msg(destination, text)
185 | send_large_msg(destination, text)
186 | end
187 |
188 | -- Save the content of _config to config.lua
189 | function save_config( )
190 | serialize_to_file(_config, './data/config.lua')
191 | print ('saved config into ./data/config.lua')
192 | end
193 |
194 | function save_gbans( )
195 | serialize_to_file(_gbans, './data/gbans.lua')
196 | print ('saved gban into ./data/gbans.lua')
197 | end
198 |
199 | -- Returns the config from config.lua file.
200 | -- If file doesn't exist, create it.
201 | function load_config( )
202 | local f = io.open('./data/config.lua', "r")
203 | -- If config.lua doesn't exist
204 | if not f then
205 | print ("Created new config file: data/config.lua")
206 | create_config()
207 | else
208 | f:close()
209 | end
210 | local config = loadfile ("./data/config.lua")()
211 | for v,user in pairs(config.sudo_users) do
212 | print('\27[93mAllowed user:\27[39m ' .. user)
213 | end
214 | return config
215 | end
216 |
217 | function load_gbans( )
218 | local f = io.open('./data/gbans.lua', "r")
219 | -- If gbans.lua doesn't exist
220 | if not f then
221 | print ("Created new gbans file: data/gbans.lua")
222 | create_gbans()
223 | else
224 | f:close()
225 | end
226 | local gbans = loadfile ("./data/gbans.lua")()
227 | return gbans
228 | end
229 |
230 | -- Create a basic config.json file and saves it.
231 | function create_config( )
232 | -- A simple config with basic plugins and ourselves as privileged user
233 | config = {
234 | enabled_plugins = {
235 | "arabic",
236 | "bot",
237 | "commands",
238 | "export_gban",
239 | "giverank",
240 | "id",
241 | "links",
242 | "moderation",
243 | "plugins",
244 | "rules",
245 | "settings",
246 | "spam",
247 | "version",
248 | },
249 | enabled_lang = {
250 | "arabic_lang",
251 | "catalan_lang",
252 | "english_lang",
253 | "galician_lang",
254 | "italian_lang",
255 | "persian_lang",
256 | "portuguese_lang",
257 | "spanish_lang",
258 | },
259 | sudo_users = {our_id},
260 | admin_users = {},
261 | disabled_channels = {}
262 | }
263 | serialize_to_file(config, './data/config.lua')
264 | print ('saved config into ./data/config.lua')
265 | end
266 |
267 | function create_gbans( )
268 | -- A simple config with basic plugins and ourselves as privileged user
269 | gbans = {
270 | gbans_users = {}
271 | }
272 | serialize_to_file(gbans, './data/gbans.lua')
273 | print ('saved gbans into ./data/gbans.lua')
274 | end
275 |
276 | function on_our_id (id)
277 | our_id = id
278 | end
279 |
280 | function on_user_update (user, what)
281 | --vardump (user)
282 | end
283 |
284 | function on_chat_update (chat, what)
285 | --vardump (chat)
286 | end
287 |
288 | function on_secret_chat_update (schat, what)
289 | --vardump (schat)
290 | end
291 |
292 | function on_get_difference_end ()
293 | end
294 |
295 | -- Enable plugins in config.lua
296 | function load_plugins()
297 | for k, v in pairs(_config.enabled_plugins) do
298 | print('\27[92mLoading plugin '.. v..'\27[39m')
299 |
300 | local ok, err = pcall(function()
301 | local t = loadfile("plugins/"..v..'.lua')()
302 | plugins[v] = t
303 | end)
304 |
305 | if not ok then
306 | print('\27[31mError loading plugin '..v..'\27[39m')
307 | print(tostring(io.popen("lua plugins/"..v..".lua"):read('*all')))
308 | print('\27[31m'..err..'\27[39m')
309 | end
310 | end
311 | end
312 |
313 | -- Enable lang in config.lua
314 | function load_lang()
315 | for k, v in pairs(_config.enabled_lang) do
316 | print('\27[92mLoading language '.. v..'\27[39m')
317 |
318 | local ok, err = pcall(function()
319 | local t = loadfile("lang/"..v..'.lua')()
320 | plugins[v] = t
321 | end)
322 |
323 | if not ok then
324 | print('\27[31mError loading language '..v..'\27[39m')
325 | print(tostring(io.popen("lua lang/"..v..".lua"):read('*all')))
326 | print('\27[31m'..err..'\27[39m')
327 | end
328 | end
329 | end
330 |
331 | -- Call and postpone execution for cron plugins
332 | function cron_plugins()
333 |
334 | for name, plugin in pairs(plugins) do
335 | -- Only plugins with cron function
336 | if plugin.cron ~= nil then
337 | plugin.cron()
338 | end
339 | end
340 |
341 | -- Called again in 5 mins
342 | postpone (cron_plugins, false, 5*60.0)
343 | end
344 |
345 | -- Start and load values
346 | our_id = 0
347 | now = os.time()
348 | math.randomseed(now)
349 | started = false
--------------------------------------------------------------------------------
/bot/permissions.lua:
--------------------------------------------------------------------------------
1 | local sudos = {
2 | "plugins",
3 | "rank_admin",
4 | "bot",
5 | "lang_install",
6 | "set_lang",
7 | "tosupergroup",
8 | "gban_installer"
9 | }
10 | local admins = {
11 | "rank_mod",
12 | "gban",
13 | "ungban",
14 | "setrules",
15 | "setphoto",
16 | "creategroup",
17 | "setname",
18 | "addbots",
19 | "setlink",
20 | "rank_guest",
21 | "description",
22 | "export_gban"
23 | }
24 | local mods = {
25 | "whois",
26 | "kick",
27 | "add",
28 | "ban",
29 | "unban",
30 | "lockmember",
31 | "mute",
32 | "unmute",
33 | "admins",
34 | "members",
35 | "welcome",
36 | "mods",
37 | "flood",
38 | "commands",
39 | "lang",
40 | "settings",
41 | "mod_commands",
42 | "no_flood_ban",
43 | "muteall",
44 | "rules",
45 | "pre_process"
46 | }
47 |
48 | local function get_tag(plugin_tag)
49 | for v,tag in pairs(sudos) do
50 | if tag == plugin_tag then
51 | return 3
52 | end
53 | end
54 | for v,tag in pairs(admins) do
55 | if tag == plugin_tag then
56 | return 2
57 | end
58 | end
59 | for v,tag in pairs(mods) do
60 | if tag == plugin_tag then
61 | return 1
62 | end
63 | end
64 | return 0
65 | end
66 |
67 | local function user_num(user_id, chat_id)
68 | if new_is_sudo(user_id) then
69 | return 3
70 | elseif is_admin(user_id) then
71 | return 2
72 | elseif is_mod(chat_id, user_id) then
73 | return 1
74 | else
75 | return 0
76 | end
77 | end
78 |
79 | function permissions(user_id, chat_id, plugin_tag)
80 | local user_is = get_tag(plugin_tag)
81 | local user_n = user_num(user_id, chat_id)
82 | if user_n >= user_is then
83 | return true
84 | else
85 | return false
86 | end
87 | end
88 |
--------------------------------------------------------------------------------
/bot/utils.lua:
--------------------------------------------------------------------------------
1 | URL = require "socket.url"
2 | http = require "socket.http"
3 | https = require "ssl.https"
4 | ltn12 = require "ltn12"
5 | serpent = require "serpent"
6 | feedparser = require "feedparser"
7 |
8 | json = (loadfile "./libs/JSON.lua")()
9 | mimetype = (loadfile "./libs/mimetype.lua")()
10 | redis = (loadfile "./libs/redis.lua")()
11 |
12 | http.TIMEOUT = 10
13 |
14 | function get_receiver(msg)
15 | if msg.to.type == 'user' then
16 | return 'user#id'..msg.from.id
17 | end
18 | if msg.to.type == 'chat' then
19 | return 'chat#id'..msg.to.id
20 | end
21 | if msg.to.type == 'encr_chat' then
22 | return msg.to.print_name
23 | end
24 | if msg.to.type == 'channel' then
25 | return 'channel#id'..msg.to.id
26 | end
27 | end
28 |
29 | function is_chat_msg( msg )
30 | if msg.to.type == 'chat' then
31 | return true
32 | end
33 | return false
34 | end
35 |
36 | function string.random(length)
37 | local str = "";
38 | for i = 1, length do
39 | math.random(97, 122)
40 | str = str..string.char(math.random(97, 122));
41 | end
42 | return str;
43 | end
44 |
45 | function string:split(sep)
46 | local sep, fields = sep or ":", {}
47 | local pattern = string.format("([^%s]+)", sep)
48 | self:gsub(pattern, function(c) fields[#fields+1] = c end)
49 | return fields
50 | end
51 |
52 | -- DEPRECATED
53 | function string.trim(s)
54 | print("string.trim(s) is DEPRECATED use string:trim() instead")
55 | return s:gsub("^%s*(.-)%s*$", "%1")
56 | end
57 |
58 | -- Removes spaces
59 | function string:trim()
60 | return self:gsub("^%s*(.-)%s*$", "%1")
61 | end
62 |
63 | function get_http_file_name(url, headers)
64 | -- Eg: foo.var
65 | local file_name = url:match("[^%w]+([%.%w]+)$")
66 | -- Any delimited alphanumeric on the url
67 | file_name = file_name or url:match("[^%w]+(%w+)[^%w]+$")
68 | -- Random name, hope content-type works
69 | file_name = file_name or str:random(5)
70 |
71 | local content_type = headers["content-type"]
72 |
73 | local extension = nil
74 | if content_type then
75 | extension = mimetype.get_mime_extension(content_type)
76 | end
77 | if extension then
78 | file_name = file_name.."."..extension
79 | end
80 |
81 | local disposition = headers["content-disposition"]
82 | if disposition then
83 | -- attachment; filename=CodeCogsEqn.png
84 | file_name = disposition:match('filename=([^;]+)') or file_name
85 | end
86 |
87 | return file_name
88 | end
89 |
90 | -- Saves file to /tmp/. If file_name isn't provided,
91 | -- will get the text after the last "/" for filename
92 | -- and content-type for extension
93 | function download_to_file(url, file_name)
94 | print("url to download: "..url)
95 |
96 | local respbody = {}
97 | local options = {
98 | url = url,
99 | sink = ltn12.sink.table(respbody),
100 | redirect = true
101 | }
102 |
103 | -- nil, code, headers, status
104 | local response = nil
105 |
106 | if url:starts('https') then
107 | options.redirect = false
108 | response = {https.request(options)}
109 | else
110 | response = {http.request(options)}
111 | end
112 |
113 | local code = response[2]
114 | local headers = response[3]
115 | local status = response[4]
116 |
117 | if code ~= 200 then return nil end
118 |
119 | file_name = file_name or get_http_file_name(url, headers)
120 |
121 | local file_path = "/tmp/"..file_name
122 | print("Saved to: "..file_path)
123 |
124 | file = io.open(file_path, "w+")
125 | file:write(table.concat(respbody))
126 | file:close()
127 |
128 | return file_path
129 | end
130 |
131 | function vardump(value)
132 | print(serpent.block(value, {comment=false}))
133 | end
134 |
135 | -- taken from http://stackoverflow.com/a/11130774/3163199
136 | function scandir(directory)
137 | local i, t, popen = 0, {}, io.popen
138 | for filename in popen('ls -a "'..directory..'"'):lines() do
139 | i = i + 1
140 | t[i] = filename
141 | end
142 | return t
143 | end
144 |
145 | -- http://www.lua.org/manual/5.2/manual.html#pdf-io.popen
146 | function run_command(str)
147 | local cmd = io.popen(str)
148 | local result = cmd:read('*all')
149 | cmd:close()
150 | return result
151 | end
152 |
153 | -- User has privileges
154 | function is_sudo(msg)
155 | local var = false
156 | -- Check users id in config
157 | for v,user in pairs(_config.sudo_users) do
158 | if user == msg.from.id then
159 | var = true
160 | end
161 | end
162 | return var
163 | end
164 |
165 | -- Returns the name of the sender
166 | function get_name(msg)
167 | local name = msg.from.first_name
168 | if name == nil then
169 | name = msg.from.id
170 | end
171 | return name
172 | end
173 |
174 | -- Returns at table of lua files inside plugins
175 | function plugins_names( )
176 | local files = {}
177 | for k, v in pairs(scandir("plugins")) do
178 | -- Ends with .lua
179 | if (v:match(".lua$")) then
180 | table.insert(files, v)
181 | end
182 | end
183 | return files
184 | end
185 |
186 | -- Function name explains what it does.
187 | function file_exists(name)
188 | local f = io.open(name,"r")
189 | if f ~= nil then
190 | io.close(f)
191 | return true
192 | else
193 | return false
194 | end
195 | end
196 |
197 | -- Save into file the data serialized for lua.
198 | -- Set uglify true to minify the file.
199 | function serialize_to_file(data, file, uglify)
200 | file = io.open(file, 'w+')
201 | local serialized
202 | if not uglify then
203 | serialized = serpent.block(data, {
204 | comment = false,
205 | name = '_'
206 | })
207 | else
208 | serialized = serpent.dump(data)
209 | end
210 | file:write(serialized)
211 | file:close()
212 | end
213 |
214 | -- Returns true if the string is empty
215 | function string:isempty()
216 | return self == nil or self == ''
217 | end
218 |
219 | -- Returns true if the string is blank
220 | function string:isblank()
221 | self = self:trim()
222 | return self:isempty()
223 | end
224 |
225 | -- DEPRECATED!!!!!
226 | function string.starts(String, Start)
227 | print("string.starts(String, Start) is DEPRECATED use string:starts(text) instead")
228 | return Start == string.sub(String,1,string.len(Start))
229 | end
230 |
231 | -- Returns true if String starts with Start
232 | function string:starts(text)
233 | return text == string.sub(self,1,string.len(text))
234 | end
235 |
236 | -- Send image to user and delete it when finished.
237 | -- cb_function and cb_extra are optionals callback
238 | function _send_photo(receiver, file_path, cb_function, cb_extra)
239 | local cb_extra = {
240 | file_path = file_path,
241 | cb_function = cb_function,
242 | cb_extra = cb_extra
243 | }
244 | -- Call to remove with optional callback
245 | send_photo(receiver, file_path, cb_function, cb_extra)
246 | end
247 |
248 | -- Download the image and send to receiver, it will be deleted.
249 | -- cb_function and cb_extra are optionals callback
250 | function send_photo_from_url(receiver, url, cb_function, cb_extra)
251 | -- If callback not provided
252 | cb_function = cb_function or ok_cb
253 | cb_extra = cb_extra or false
254 |
255 | local file_path = download_to_file(url, false)
256 | if not file_path then -- Error
257 | local text = 'Error downloading the image'
258 | send_msg(receiver, text, cb_function, cb_extra)
259 | else
260 | print("File path: "..file_path)
261 | _send_photo(receiver, file_path, cb_function, cb_extra)
262 | end
263 | end
264 |
265 | -- Same as send_photo_from_url but as callback function
266 | function send_photo_from_url_callback(cb_extra, success, result)
267 | local receiver = cb_extra.receiver
268 | local url = cb_extra.url
269 |
270 | local file_path = download_to_file(url, false)
271 | if not file_path then -- Error
272 | local text = 'Error downloading the image'
273 | send_msg(receiver, text, ok_cb, false)
274 | else
275 | print("File path: "..file_path)
276 | _send_photo(receiver, file_path, ok_cb, false)
277 | end
278 | end
279 |
280 | -- Send multiple images asynchronous.
281 | -- param urls must be a table.
282 | function send_photos_from_url(receiver, urls)
283 | local cb_extra = {
284 | receiver = receiver,
285 | urls = urls,
286 | remove_path = nil
287 | }
288 | send_photos_from_url_callback(cb_extra)
289 | end
290 |
291 | -- Use send_photos_from_url.
292 | -- This function might be difficult to understand.
293 | function send_photos_from_url_callback(cb_extra, success, result)
294 | -- cb_extra is a table containing receiver, urls and remove_path
295 | local receiver = cb_extra.receiver
296 | local urls = cb_extra.urls
297 | local remove_path = cb_extra.remove_path
298 |
299 | -- The previously image to remove
300 | if remove_path ~= nil then
301 | os.remove(remove_path)
302 | print("Deleted: "..remove_path)
303 | end
304 |
305 | -- Nil or empty, exit case (no more urls)
306 | if urls == nil or #urls == 0 then
307 | return false
308 | end
309 |
310 | -- Take the head and remove from urls table
311 | local head = table.remove(urls, 1)
312 |
313 | local file_path = download_to_file(head, false)
314 | local cb_extra = {
315 | receiver = receiver,
316 | urls = urls,
317 | remove_path = file_path
318 | }
319 |
320 | -- Send first and postpone the others as callback
321 | send_photo(receiver, file_path, send_photos_from_url_callback, cb_extra)
322 | end
323 |
324 | -- Callback to remove a file
325 | function rmtmp_cb(cb_extra, success, result)
326 | local file_path = cb_extra.file_path
327 | local cb_function = cb_extra.cb_function or ok_cb
328 | local cb_extra = cb_extra.cb_extra
329 |
330 | if file_path ~= nil then
331 | os.remove(file_path)
332 | print("Deleted: "..file_path)
333 | end
334 | -- Finally call the callback
335 | cb_function(cb_extra, success, result)
336 | end
337 |
338 | -- Send document to user and delete it when finished.
339 | -- cb_function and cb_extra are optionals callback
340 | function _send_document(receiver, file_path, cb_function, cb_extra)
341 | local cb_extra = {
342 | file_path = file_path,
343 | cb_function = cb_function or ok_cb,
344 | cb_extra = cb_extra or false
345 | }
346 | -- Call to remove with optional callback
347 | send_document(receiver, file_path, rmtmp_cb, cb_extra)
348 | end
349 |
350 | -- Download the image and send to receiver, it will be deleted.
351 | -- cb_function and cb_extra are optionals callback
352 | function send_document_from_url(receiver, url, cb_function, cb_extra)
353 | local file_path = download_to_file(url, false)
354 | print("File path: "..file_path)
355 | _send_document(receiver, file_path, cb_function, cb_extra)
356 | end
357 |
358 | -- Parameters in ?a=1&b=2 style
359 | function format_http_params(params, is_get)
360 | local str = ''
361 | -- If is get add ? to the beginning
362 | if is_get then str = '?' end
363 | local first = true -- Frist param
364 | for k,v in pairs (params) do
365 | if v then -- nil value
366 | if first then
367 | first = false
368 | str = str..k.. "="..v
369 | else
370 | str = str.."&"..k.. "="..v
371 | end
372 | end
373 | end
374 | return str
375 | end
376 |
377 | -- Check if user can use the plugin and warns user
378 | -- Returns true if user was warned and false if not warned (is allowed)
379 | function warns_user_not_allowed(plugin, msg)
380 | if not user_allowed(plugin, msg) then
381 | local text = 'This plugin requires privileged user'
382 | local receiver = get_receiver(msg)
383 | send_msg(receiver, text, ok_cb, false)
384 | return true
385 | else
386 | return false
387 | end
388 | end
389 |
390 | -- Check if user can use the plugin
391 | function user_allowed(plugin, msg)
392 | if plugin.privileged and not is_sudo(msg) then
393 | return false
394 | end
395 | return true
396 | end
397 |
398 |
399 | function send_order_msg(destination, msgs)
400 | local cb_extra = {
401 | destination = destination,
402 | msgs = msgs
403 | }
404 | send_order_msg_callback(cb_extra, true)
405 | end
406 |
407 | function send_order_msg_callback(cb_extra, success, result)
408 | local destination = cb_extra.destination
409 | local msgs = cb_extra.msgs
410 | local file_path = cb_extra.file_path
411 | if file_path ~= nil then
412 | os.remove(file_path)
413 | print("Deleted: " .. file_path)
414 | end
415 | if type(msgs) == 'string' then
416 | send_large_msg(destination, msgs)
417 | elseif type(msgs) ~= 'table' then
418 | return
419 | end
420 | if #msgs < 1 then
421 | return
422 | end
423 | local msg = table.remove(msgs, 1)
424 | local new_cb_extra = {
425 | destination = destination,
426 | msgs = msgs
427 | }
428 | if type(msg) == 'string' then
429 | send_msg(destination, msg, send_order_msg_callback, new_cb_extra)
430 | elseif type(msg) == 'table' then
431 | local typ = msg[1]
432 | local nmsg = msg[2]
433 | new_cb_extra.file_path = nmsg
434 | if typ == 'document' then
435 | send_document(destination, nmsg, send_order_msg_callback, new_cb_extra)
436 | elseif typ == 'image' or typ == 'photo' then
437 | send_photo(destination, nmsg, send_order_msg_callback, new_cb_extra)
438 | elseif typ == 'audio' then
439 | send_audio(destination, nmsg, send_order_msg_callback, new_cb_extra)
440 | elseif typ == 'video' then
441 | send_video(destination, nmsg, send_order_msg_callback, new_cb_extra)
442 | else
443 | send_file(destination, nmsg, send_order_msg_callback, new_cb_extra)
444 | end
445 | end
446 | end
447 |
448 | -- Same as send_large_msg_callback but friendly params
449 | function send_large_msg(destination, text)
450 | local cb_extra = {
451 | destination = destination,
452 | text = text
453 | }
454 | send_large_msg_callback(cb_extra, true)
455 | end
456 |
457 | -- If text is longer than 4096 chars, send multiple msg.
458 | -- https://core.telegram.org/method/messages.sendMessage
459 | function send_large_msg_callback(cb_extra, success, result)
460 | local text_max = 4096
461 |
462 | local destination = cb_extra.destination
463 | local text = cb_extra.text
464 | local text_len = string.len(text)
465 | local num_msg = math.ceil(text_len / text_max)
466 |
467 | if num_msg <= 1 then
468 | send_msg(destination, text, ok_cb, false)
469 | else
470 |
471 | local my_text = string.sub(text, 1, 4096)
472 | local rest = string.sub(text, 4096, text_len)
473 |
474 | local cb_extra = {
475 | destination = destination,
476 | text = rest
477 | }
478 |
479 | send_msg(destination, my_text, send_large_msg_callback, cb_extra)
480 | end
481 | end
482 |
483 | -- Returns a table with matches or nil
484 | function match_pattern(pattern, text, lower_case)
485 | if text then
486 | local matches = {}
487 | if lower_case then
488 | matches = { string.match(text:lower(), pattern) }
489 | else
490 | matches = { string.match(text, pattern) }
491 | end
492 | if next(matches) then
493 | return matches
494 | end
495 | end
496 | -- nil
497 | end
498 |
499 | -- Function to read data from files
500 | function load_from_file(file, default_data)
501 | local f = io.open(file, "r+")
502 | -- If file doesn't exists
503 | if f == nil then
504 | -- Create a new empty table
505 | default_data = default_data or {}
506 | serialize_to_file(default_data, file)
507 | print ('Created file', file)
508 | else
509 | print ('Data loaded from file', file)
510 | f:close()
511 | end
512 | return loadfile (file)()
513 | end
514 |
515 | -- See http://stackoverflow.com/a/14899740
516 | function unescape_html(str)
517 | local map = {
518 | ["lt"] = "<",
519 | ["gt"] = ">",
520 | ["amp"] = "&",
521 | ["quot"] = '"',
522 | ["apos"] = "'"
523 | }
524 | new = string.gsub(str, '(&(#?x?)([%d%a]+);)', function(orig, n, s)
525 | var = map[s] or n == "#" and string.char(s)
526 | var = var or n == "#x" and string.char(tonumber(s,16))
527 | var = var or orig
528 | return var
529 | end)
530 | return new
531 | end
532 |
533 | -- Workarrond to format the message as previously was received
534 | function backward_msg_format (msg)
535 | for k,name in ipairs({'from', 'to'}) do
536 | local longid = msg[name].id
537 | msg[name].id = msg[name].peer_id
538 | msg[name].peer_id = longid
539 | msg[name].type = msg[name].peer_type
540 | end
541 | if msg.action and (msg.action.user or msg.action.link_issuer) then
542 | local user = msg.action.user or msg.action.link_issuer
543 | local longid = user.id
544 | user.id = user.peer_id
545 | user.peer_id = longid
546 | user.type = user.peer_type
547 | end
548 | return msg
549 | end
550 |
551 | function is_admin(user_id)
552 | for v,user in pairs(_config.admin_users) do
553 | print(user[1])
554 | if user[1] == user_id then
555 | return true
556 | end
557 | end
558 | return false
559 | end
560 |
561 | function is_id(name_id)
562 | local var = tonumber(name_id)
563 | if var then
564 | return true
565 | else
566 | return false
567 | end
568 | end
569 |
570 | function lang_text(chat_id, keyword)
571 | local hash = 'langset:'..chat_id
572 | local lang = redis:get(hash)
573 | if not lang then
574 | redis:set(hash,'en')
575 | lang = redis:get(hash)
576 | end
577 | local hashtext = 'lang:'..lang..':'..keyword
578 | if redis:get(hashtext) then
579 | return redis:get(hashtext)
580 | else
581 | return 'Please, install your selected "'..lang..'" language by #install [archive_name(english_lang, spanish_lang...)]. First, active your language package like a normal plugin by it\'s name. For example, #plugins enable english_lang. Or set another one by typing #lang [language(en, es...)].'
582 | end
583 |
584 | end
585 |
586 | function set_text(lang, keyword, text)
587 | local hash = 'lang:'..lang..':'..keyword
588 | redis:set(hash, text)
589 | end
590 |
591 | function is_mod(chat_id, user_id)
592 | local hash = 'mod:'..chat_id..':'..user_id
593 | if redis:get(hash) then
594 | return true
595 | else
596 | return false
597 | end
598 | end
599 |
600 | function send_report(msg)
601 | local text = '👤 '..lang_text(msg.to.id, 'reportUser')..': '..msg.from.username..' ('..msg.from.id..')\n‼ '..lang_text(msg.to.id, 'reportReason')..': Link\n💬 '..lang_text(msg.to.id, 'reportGroup')..': "'..msg.to.title..'" ('..msg.to.id..')\n✉ '..lang_text(msg.to.id, 'reportMessage')..': '..msg.text
602 | for v,user in pairs(_config.sudo_users) do
603 | send_msg('user#id'..user, text, ok_cb, true)
604 | end
605 | end
606 |
607 | function is_gbanned_table(user_id)
608 | for v,user in pairs(_gbans.gbans_users) do
609 | if tonumber(user) == tonumber(user_id) then
610 | return true
611 | end
612 | end
613 | return false
614 | end
615 |
616 | function gban_id(user_id)
617 | local hash = 'gban:'..user_id
618 | redis:set(hash, true)
619 |
620 | if not is_gbanned_table(user_id) then
621 | table.insert(_gbans.gbans_users, tonumber(user_id))
622 | print(user_id..' added to _gbans table')
623 | save_gbans()
624 | end
625 | end
626 |
627 | function new_is_sudo(user_id)
628 | local var = false
629 | -- Check users id in config
630 | for v,user in pairs(_config.sudo_users) do
631 | if user == user_id then
632 | var = true
633 | end
634 | end
635 | return var
636 | end
637 |
--------------------------------------------------------------------------------
/config_fix.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #Script to fix config.lua By @iicc1
3 | #DBTeam
4 |
5 | CONF=data/config.lua
6 | CONF2=data/config2.lua
7 |
8 | cat $CONF | grep "enabled_lang" > /dev/null
9 | if [ $? == 0 ]; then
10 | echo -e "\e[33mPatching config.lua not needed.\e[36m"
11 | exit 0
12 | else
13 |
14 | echo -e "\e[33mPatching config.lua languages...\e[39m"
15 | sleep 1.5
16 |
17 | #config.lua backup
18 | cp $CONF ${CONF}.backup
19 |
20 | grep -v "_lang" $CONF > $CONF2
21 |
22 | awk '/sudo_users/{print " enabled_lang = {"}1' $CONF2 > $CONF
23 | sed 's/.*enabled_lang.*/&\n "arabic_lang",/' $CONF > $CONF2
24 | sed 's/.*arabic_lang.*/&\n "catalan_lang",/' $CONF2 > $CONF
25 | sed 's/.*catalan_lang.*/&\n "english_lang",/' $CONF > $CONF2
26 | sed 's/.*english_lang.*/&\n "galician_lang",/' $CONF2 > $CONF
27 | sed 's/.*galician_lang.*/&\n "italian_lang",/' $CONF > $CONF2
28 | sed 's/.*italian_lang.*/&\n "persian_lang",/' $CONF2 > $CONF
29 | sed 's/.*persian_lang.*/&\n "portuguese_lang",/' $CONF > $CONF2
30 | sed 's/.*portuguese_lang.*/&\n "spanish_lang"/' $CONF2 > $CONF
31 | sed 's/.*spanish_lang.*/&\n },/' $CONF > $CONF2
32 | mv $CONF2 $CONF
33 | echo -e "\e[96mDone!\e[36m"
34 | fi
35 |
--------------------------------------------------------------------------------
/data/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/data/photos/text:
--------------------------------------------------------------------------------
1 | text
2 |
--------------------------------------------------------------------------------
/etc/telegram.conf:
--------------------------------------------------------------------------------
1 | description "Telegram-bot upstart script"
2 |
3 | respawn
4 | respawn limit 15 5
5 |
6 | start on runlevel [2345]
7 | stop on shutdown
8 |
9 | setuid yourusername
10 | exec /bin/sh telegrambotpath/launch.sh
11 |
--------------------------------------------------------------------------------
/lang/arabic_lang.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------
2 | -- ____ ____ _____ --
3 | -- | \| _ )_ _|___ ____ __ __ --
4 | -- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
5 | -- |____/|____/ |_|\____/\_____|_/\/\_| --
6 | -- --
7 | --------------------------------------------------
8 | -- --
9 | -- Developers: @Josepdal & @MaSkAoS --
10 | -- Support: @Skneos, @iicc1 & @serx666 --
11 | -- --
12 | -- Translated by Wathiq Al-Qajar { @iluli } --
13 | -- --
14 | --------------------------------------------------
15 |
16 | local LANG = 'ar'
17 |
18 | local function run(msg, matches)
19 | if permissions(msg.from.id, msg.to.id, "lang_install") then
20 |
21 | -------------------------
22 | -- Translation version --
23 | -------------------------
24 | set_text(LANG, 'version', '0.2')
25 | set_text(LANG, 'versionExtended', 'إصدار الترجمة 0.2')
26 |
27 | -------------
28 | -- Plugins --
29 | -------------
30 |
31 | -- global plugins --
32 | set_text(LANG, 'require_sudo', 'هذا الامر يتطلب امتيازات مطور.')
33 | set_text(LANG, 'require_admin', 'هذا الامر يتطلب امتيازات مسؤول أو أعلى.')
34 | set_text(LANG, 'require_mod', 'هذا الامر يتطلب امتيازات أدمن أو أعلى.')
35 |
36 | -- welcome.lua
37 | set_text(LANG, 'weloff', 'الترحيب مفعل')
38 | set_text(LANG, 'welon', 'الترحيب غير مفعل')
39 | set_text(LANG, 'byeon', 'التوديع مفعل')
40 | set_text(LANG, 'byeoff', 'التوديع غير مفعل')
41 | set_text(LANG, 'welcome1', 'اهلا ')
42 | set_text(LANG, 'welcome2', 'مرحبا بكم في ')
43 | set_text(LANG, 'weldefault', 'الترحيب هو الافتراضي.')
44 | set_text(LANG, 'byedefault', 'الماوادعة هي الافتراضية.')
45 | set_text(LANG, 'newbye', 'حفظ وداعا! هو')
46 | set_text(LANG, 'bye1', 'وداعا ')
47 | set_text(LANG, 'bye2', ' شكرا على الزيارة.')
48 | set_text(LANG, 'welnew', 'نرحب بكم حفظ! هو')
49 |
50 | -- Spam.lua --
51 | set_text(LANG, 'reportUser', 'العضو')
52 | set_text(LANG, 'reportReason', 'تقرير السبب')
53 | set_text(LANG, 'reportGroup', 'المجموعة')
54 | set_text(LANG, 'reportMessage', 'رسالة')
55 |
56 | set_text(LANG, 'allowedSpamT', 'البريد المزعج الآن متاح في هذه المجموعة.')
57 | set_text(LANG, 'allowedSpamL', 'البريد المزعج الآن متاح في هذه المجموعة الخارقة.')
58 | set_text(LANG, 'notAllowedSpamT', 'البريد المزعج غير متاح في هذه المجموعة.')
59 | set_text(LANG, 'notAllowedSpamL', 'البريد المزعج غير متاح في هذه المجموعة الخارقة.')
60 |
61 | -- bot.lua --
62 | set_text(LANG, 'botOn', 'لقد عُدت. دعونا نفعل ذلك 😅')
63 | set_text(LANG, 'botOff', 'لا شيء نفعله هُنا 😔')
64 |
65 | -- settings.lua --
66 | set_text(LANG, 'user', 'العضو')
67 | set_text(LANG, 'isFlooding', 'يقوم بالتكرار')
68 |
69 | set_text(LANG, 'noStickersT', 'الملصقات غير متاحة في هذه المجموعة.')
70 | set_text(LANG, 'noStickersL', 'الملصقات غير متاحة في هذه المجموعة الخارقة.')
71 | set_text(LANG, 'stickersT', 'الملصقات الآن متاحة في هذه المجموعة.')
72 | set_text(LANG, 'stickersL', 'الملصقات الآن متاحة في هذه المجموعة الخارقة.')
73 |
74 | set_text(LANG, 'noTgservicesT', 'خدمات التليگرام غير متاحة في هذه المجموعة.')
75 | set_text(LANG, 'noTgservicesL', 'خدمات التليگرام غير متاحة في هذه المجموعة الخارقة.')
76 | set_text(LANG, 'tgservicesT', 'خدمات التليگرام الآن متاحة في هذه المجموعة.')
77 | set_text(LANG, 'tgservicesL', 'خدمات التليگرام الآن متاحة في هذه المجموعة الخارقة.')
78 |
79 | set_text(LANG, 'LinksT', 'الروابط الآن متاحة في هذه المجموعة.')
80 | set_text(LANG, 'LinksL', 'الروابط الآن متاحة في هذه المجموعة الخارقة.')
81 | set_text(LANG, 'noLinksT', 'الروابط غير متاحة في هذه المجموعة.')
82 | set_text(LANG, 'noLinksL', 'الروابط غير متاحة في هذه المجموعة الخارقة.')
83 |
84 | set_text(LANG, 'gifsT', 'الصور المتحركة الآن متاحة في هذه المجموعة.')
85 | set_text(LANG, 'gifsL', 'الصور المتحركة الآن متاحة في هذه المجموعة الخارقة.')
86 | set_text(LANG, 'noGifsT', 'الصور المتحركة غير متاحة في هذه المجموعة.')
87 | set_text(LANG, 'noGifsL', 'الصور المتحركة غير متاحة في هذه المجموعة الخارقة.')
88 |
89 | set_text(LANG, 'photosT', 'الصور الآن متاحة في هذه المجموعة.')
90 | set_text(LANG, 'photosL', 'الصور الآن متاحة في هذه المجموعة الخارقة.')
91 | set_text(LANG, 'noPhotosT', 'الصور غير متاحة في هذه المجموعة.')
92 | set_text(LANG, 'noPhotosL', 'الصور غير متاحة في هذه المجموعة الخارقة.')
93 |
94 | set_text(LANG, 'botsT', 'البوتات الآن متاحة في هذه المجموعة.')
95 | set_text(LANG, 'botsL', 'البوتات الآن متاحة في هذه المجموعة الخارقة.')
96 | set_text(LANG, 'noBotsT', 'البوتات غير متاحة في هذه المجموعة.')
97 | set_text(LANG, 'noBotsL', 'البوتات غير متاحة في هذه المجموعة الخارقة.')
98 |
99 | set_text(LANG, 'arabicT', 'العربية الآن متاحة في هذه المجموعة.')
100 | set_text(LANG, 'arabicL', 'العربية الآن متاحة في هذه المجموعة الخارقة.')
101 | set_text(LANG, 'noArabicT', 'العربية غير متاحة في هذه المجموعة.')
102 | set_text(LANG, 'noArabicL', 'العربية غير متاحة في هذه المجموعة الخارقة.')
103 |
104 | set_text(LANG, 'audiosT', 'الصوتيات الآن متاحة في هذه المجموعة.')
105 | set_text(LANG, 'audiosL', 'الصوتيات الآن متاحة في هذه المجموعة الخارقة.')
106 | set_text(LANG, 'noAudiosT', 'الصوتيات غير متاحة في هذه المجموعة.')
107 | set_text(LANG, 'noAudiosL', 'الصوتيات غير متاحة في هذه المجموعة الخارقة.')
108 |
109 | set_text(LANG, 'kickmeT', 'الطرد التلقائي الآن متاح في هذه المجموعة.')
110 | set_text(LANG, 'kickmeL', 'الطرد التلقائي الآن متاح في هذه المجموعة الخارقة.')
111 | set_text(LANG, 'noKickmeT', 'الطرد التلقائي غير متاح في هذه المجموعة.')
112 | set_text(LANG, 'noKickmeL', 'الطرد التلقائي غير متاح في هذه المجموعة الخارقة.')
113 |
114 | set_text(LANG, 'floodT', 'التكرار الآن متاح في هذه المجموعة.')
115 | set_text(LANG, 'floodL', 'التكرار الآن متاح في هذه المجموعة الخارقة.')
116 | set_text(LANG, 'noFloodT', 'التكرار غير متاح في هذه المجموعة.')
117 | set_text(LANG, 'noFloodL', 'التكرار غير متاح في هذه المجموعة الخارقة.')
118 |
119 | set_text(LANG, 'floodTime', 'تم ضبط اختيار وقت التكرار لـ ')
120 | set_text(LANG, 'floodMax', 'تم تعيين الحد الأقصى لرسائل التكرار لـ ')
121 |
122 | set_text(LANG, 'gSettings', 'اعدادات المجموعة')
123 | set_text(LANG, 'sSettings', 'اعدادات المجموعة الخارقة')
124 |
125 | set_text(LANG, 'allowed', 'سماح')
126 | set_text(LANG, 'noAllowed', 'لاتسمح')
127 | set_text(LANG, 'noSet', 'غير مضبوط')
128 |
129 | set_text(LANG, 'stickers', 'الملصقات')
130 | set_text(LANG, 'tgservices', 'خدمات التليگرام')
131 | set_text(LANG, 'links', 'الروابط')
132 | set_text(LANG, 'arabic', 'العربية')
133 | set_text(LANG, 'bots', 'البوتات')
134 | set_text(LANG, 'gifs', 'الصور المتحركة')
135 | set_text(LANG, 'photos', 'الصور')
136 | set_text(LANG, 'audios', 'الصوتيات')
137 | set_text(LANG, 'kickme', 'اطردني')
138 | set_text(LANG, 'spam', 'البريد المزعج')
139 | set_text(LANG, 'gName', 'اسم المجموعة')
140 | set_text(LANG, 'flood', 'التكرار')
141 | set_text(LANG, 'language', 'اللغة')
142 | set_text(LANG, 'mFlood', 'الحد الأقصى للتكرار')
143 | set_text(LANG, 'tFlood', 'وقت التكرار')
144 | set_text(LANG, 'setphoto', 'وضع صورة')
145 |
146 | set_text(LANG, 'photoSaved', 'تم حفظ الصورة!')
147 | set_text(LANG, 'photoFailed', 'فشل, الرجاء المحاولة مجدداً!')
148 | set_text(LANG, 'setPhotoAborted', 'توقفت عملية وضع صورة...')
149 | set_text(LANG, 'sendPhoto', 'رجاءً, ارسل الصورة')
150 |
151 | set_text(LANG, 'chatSetphoto', 'الآن يمكنك وضع صورة في هذه المجموعة.')
152 | set_text(LANG, 'channelSetphoto', 'الآن يمكنك وضع صورة في هذه المجموعة الخارقة.')
153 | set_text(LANG, 'notChatSetphoto', 'الآن لايمكنك وضع صورة في هذه المجموعة.')
154 | set_text(LANG, 'notChannelSetphoto', 'الآن لايمكنك وضع صورة في هذه المجموعة الخارقة.')
155 | set_text(LANG, 'setPhotoError', 'رجاءً, قم بتفعيل اعدادات وضع الصورة.')
156 |
157 | set_text(LANG, 'linkSaved', 'تم حفظ الرابط الجديد.')
158 | set_text(LANG, 'groupLink', 'رابط المجموعة')
159 | set_text(LANG, 'sGroupLink', 'رابط المجموعة الخارقة')
160 | set_text(LANG, 'noLinkSet', 'لم يتم وضع رابط, رجاءً ضع رابط بواسطة #setlink [الرابط].')
161 |
162 | set_text(LANG, 'chatRename', 'الآن يمكنك إعادة تسمية المجموعة.')
163 | set_text(LANG, 'channelRename', 'الآن يمكنك إعادة تسمية المجموعة الخارقة.')
164 | set_text(LANG, 'notChatRename', 'الآن لايمكنك إعادة تسمية المجموعة.')
165 | set_text(LANG, 'notChannelRename', 'الآن لايمكنك إعادة تسمية المجموعة الخارقة.')
166 |
167 | set_text(LANG, 'lockMembersT', 'تم قفل عدد اعضاء المجموعة.')
168 | set_text(LANG, 'lockMembersL', 'تم قفل عدد اعضاء المجموعة الخارقة.')
169 |
170 | set_text(LANG, 'notLockMembersT', 'الآن تم فتح عدد اعضاء المجموعة.')
171 | set_text(LANG, 'notLockMembersL', 'الآن تم فتح عدد اعضاء المجموعة الخارقة.')
172 |
173 | set_text(LANG, 'langUpdated', 'تم تحديث لغتك لـ: ')
174 |
175 | set_text(LANG, 'chatUpgrade', 'تم ترقية المجموعة بنجاح.')
176 | set_text(LANG, 'notInChann', 'لا تستطيع عمل ذلك في المجموعة الخارقة.')
177 |
178 | set_text(LANG, 'chatUpgrade', 'تم ترقية المجموعة بنجاح.')
179 | set_text(LANG, 'notInChann', 'لا تستطيع عمل ذلك في المجموعة الخارقة.')
180 | set_text(LANG, 'desChanged', 'تم تغيير وصف المجموعة الخارقة.')
181 | set_text(LANG, 'desOnlyChannels', 'تستطيع تغيير الوصف فقط في المجموعات الخارقة.')
182 |
183 | set_text(LANG, 'muteAll', 'تم كتم المجموعة الآن.')
184 | set_text(LANG, 'unmuteAll', 'تم الغاء كتم المجموعة.')
185 | set_text(LANG, 'muteAllX:1', 'تم كتم المجموعة لـ')
186 | set_text(LANG, 'muteAllX:2', 'ثواني.')
187 |
188 | set_text(LANG, 'createGroup:1', 'تم صنعها')
189 | set_text(LANG, 'createGroup:2', 'المجموعة.')
190 | set_text(LANG, 'newGroupWelcome', 'مرحباً بك في مجموعتك الجديدة.')
191 |
192 | -- export_gban.lua --
193 | set_text(LANG, 'accountsGban', 'الحسابات المحظورة عام.')
194 |
195 | -- giverank.lua --
196 | set_text(LANG, 'alreadyAdmin', 'هذا العضو هو بالفعل مشرف.')
197 | set_text(LANG, 'alreadyMod', 'هذا العضو هو بالفعل مسؤول.')
198 |
199 | set_text(LANG, 'newAdmin', 'المشرف الجديد')
200 | set_text(LANG, 'newMod', 'المسؤول الجديد')
201 | set_text(LANG, 'nowUser', 'هو الآن عضو.')
202 |
203 | set_text(LANG, 'modList', 'قائمة المسؤولين')
204 | set_text(LANG, 'adminList', 'قائمة المشرفين')
205 | set_text(LANG, 'modEmpty', 'قائمة المسؤولين فارغة في هذه المجموعة.')
206 | set_text(LANG, 'adminEmpty', 'قائمة المشرفين فارغة.')
207 |
208 | -- id.lua --
209 | set_text(LANG, 'user', 'العضو')
210 | set_text(LANG, 'supergroupName', 'اسم المجموعة الخارقة')
211 | set_text(LANG, 'chatName', 'اسم المجموعة')
212 | set_text(LANG, 'supergroup', 'مجموعة خارقة')
213 | set_text(LANG, 'chat', 'المجموعة')
214 |
215 | -- moderation.lua --
216 | set_text(LANG, 'userUnmuted:1', 'العضو')
217 | set_text(LANG, 'userUnmuted:2', 'تم الغاء كتمه.')
218 |
219 | set_text(LANG, 'userMuted:1', 'العضو')
220 | set_text(LANG, 'userMuted:2', 'تم كتمه.')
221 |
222 | set_text(LANG, 'kickUser:1', 'العضو')
223 | set_text(LANG, 'kickUser:2', 'تم طرده.')
224 |
225 | set_text(LANG, 'banUser:1', 'العضو')
226 | set_text(LANG, 'banUser:2', 'تم حظره.')
227 |
228 | set_text(LANG, 'unbanUser:1', 'العضو')
229 | set_text(LANG, 'unbanUser:2', 'تم الغاء حظره.')
230 |
231 | set_text(LANG, 'gbanUser:1', 'العضو')
232 | set_text(LANG, 'gbanUser:2', 'تم حظره عام.')
233 |
234 | set_text(LANG, 'ungbanUser:1', 'العضو')
235 | set_text(LANG, 'ungbanUser:2', 'تم الغاء حظره العام.')
236 |
237 | set_text(LANG, 'addUser:1', 'العضو')
238 | set_text(LANG, 'addUser:2', 'اضيف للمجموعة.')
239 | set_text(LANG, 'addUser:3', 'اضيف للمجموعة الخارقة.')
240 |
241 | set_text(LANG, 'kickmeBye', 'وداعاً.')
242 |
243 | -- plugins.lua --
244 | set_text(LANG, 'plugins', 'الاضافات')
245 | set_text(LANG, 'installedPlugins', 'الاضافات المثبته.')
246 | set_text(LANG, 'pEnabled', 'مفعلة.')
247 | set_text(LANG, 'pDisabled', 'معطلة.')
248 |
249 | set_text(LANG, 'isEnabled:1', 'الاضافة')
250 | set_text(LANG, 'isEnabled:2', 'تم تفعيلها.')
251 |
252 | set_text(LANG, 'notExist:1', 'الاضافة')
253 | set_text(LANG, 'notExist:2', 'غير موجودة.')
254 |
255 | set_text(LANG, 'notEnabled:1', 'الاضافة')
256 | set_text(LANG, 'notEnabled:2', 'غير مفعلة.')
257 |
258 | set_text(LANG, 'pNotExists', 'الاضافة غير موجودة.')
259 |
260 | set_text(LANG, 'pDisChat:1', 'الاضافة')
261 | set_text(LANG, 'pDisChat:2', 'تم تعطيلها في هذه المجموعة.')
262 |
263 | set_text(LANG, 'anyDisPlugin', 'لاتوجد أي اضافات معطلة.')
264 | set_text(LANG, 'anyDisPluginChat', 'لاتوجد أي اضافات معطلة لهذه المجموعة.')
265 | set_text(LANG, 'notDisabled', 'هذه الاضافة غير معطلة')
266 |
267 | set_text(LANG, 'enabledAgain:1', 'الاضافة')
268 | set_text(LANG, 'enabledAgain:2', 'تم تفعيلها مرة اخرى')
269 |
270 | -- commands.lua --
271 | set_text(LANG, 'commandsT', 'الأوامر')
272 | set_text(LANG, 'errorNoPlug', 'الاضافة غير موجودة أو لم يتم استخدامها.')
273 |
274 | -- rules.lua --
275 | set_text(LANG, 'setRules', 'تم تحديث قوانين المجموعة.')
276 | set_text(LANG, 'remRules', 'تم ازالة قوانين المجموعة.')
277 |
278 | ------------
279 | -- Usages --
280 | ------------
281 |
282 | -- bot.lua --
283 | set_text(LANG, 'bot:0', 2)
284 | set_text(LANG, 'bot:1', '#bot on: تفعيل البوت')
285 | set_text(LANG, 'bot:2', '#bot off: تعطيل البوت')
286 |
287 | -- commands.lua --
288 | set_text(LANG, 'commands:0', 2)
289 | set_text(LANG, 'commands:1', '#commands: الأوامر لكل اضافة')
290 | set_text(LANG, 'commands:2', '#commands [plugin]: الأوامر لهذه الاضافة')
291 |
292 | -- export_gban.lua --
293 | set_text(LANG, 'export_gban:0', 2)
294 | set_text(LANG, 'export_gban:1', '#gbans installer: لتثبيت قائمه المحظورين عام في بوت اخر بأمر واحد')
295 | set_text(LANG, 'export_gban:2', '#gbans list: ارشيف بقائمة من المحظورين عام')
296 |
297 | -- gban_installer.lua --
298 | set_text(LANG, 'gban_installer:0', 1)
299 | set_text(LANG, 'gban_installer:1', '#install gbans: اضافة قائمة المحظورين لبوتك')
300 |
301 | -- welcome.lua --
302 | set_text(LANG, 'welcome:0', 6)
303 | set_text(LANG, 'welcome:1', '#setwelcome [text for welcome]. يمكنك جعل رسالة ترحيب مخصصة لهذه المجموعة')
304 | set_text(LANG, 'welcome:2', '#setbye [text for farewell]. يمكنك جعل رسالة توديع مخصصة لهذه المجموعة')
305 | set_text(LANG, 'welcome:3', '#getwelcome - إرجاع الترحيب الحالي في هذه المجموعة')
306 | set_text(LANG, 'welcome:4', '#getbye - إرجاع التوديع الحالي في هذه المجموعة')
307 | set_text(LANG, 'welcome:5', '#welcome on/off - تفعيل/الغاء تفعيل الترحيب في المجموعة')
308 | set_text(LANG, 'welcome:6', '#bye on/off - تفعيل/الغاء تفعيل التوديع في المجموعة')
309 |
310 | -- giverank.lua --
311 | set_text(LANG, 'giverank:0', 9)
312 | set_text(LANG, 'giverank:1', '#rank admin (reply): اضافة مشرف بالرد')
313 | set_text(LANG, 'giverank:2', '#rank admin /: اضافة مشرف بواسطة الايدي/المعرف')
314 | set_text(LANG, 'giverank:3', '#rank mod (reply): اضافة مسؤول بالرد')
315 | set_text(LANG, 'giverank:4', '#rank mod /: اضافة مسؤول بواسطة الايدي/المعرف')
316 | set_text(LANG, 'giverank:5', '#rank guest (reply): ازالة مشرف بالرد')
317 | set_text(LANG, 'giverank:6', '#rank guest /: ازالة مشرف بواسطة الايدي/المعرف')
318 | set_text(LANG, 'giverank:7', '#admins: قائمة بجميع المشرفين')
319 | set_text(LANG, 'giverank:8', '#mods: قائمة بجميع المسؤولين')
320 | set_text(LANG, 'giverank:9', '#members: قائمة بجميع الأعضاء')
321 |
322 | -- id.lua --
323 | set_text(LANG, 'id:0', 6)
324 | set_text(LANG, 'id:1', '#id: اظهار ايدي الشخص والمجموعة')
325 | set_text(LANG, 'id:2', '#ids chat: اظهار ايدي الأعضاء')
326 | set_text(LANG, 'id:3', '#ids channel: اظهار ايدي اعضاء المجموعة الخارقة')
327 | set_text(LANG, 'id:4', '#id : اظهار الايدي للمعرف')
328 | set_text(LANG, 'id:5', '#whois /: اظهار معرف الشخص')
329 | set_text(LANG, 'id:6', '#whois (reply): اظهار الايدي بالرد')
330 |
331 | -- moderation.lua --
332 | set_text(LANG, 'moderation:0', 18)
333 | set_text(LANG, 'moderation:1', '#add: اضافة عضو بالرد.')
334 | set_text(LANG, 'moderation:2', '#add /: اضافة عضو بالمعرف او الايدي')
335 | set_text(LANG, 'moderation:3', '#kick: طرد بالرد')
336 | set_text(LANG, 'moderation:4', '#kick /: طرد بالمعرف او الايدي')
337 | set_text(LANG, 'moderation:5', '#kickme: طرد نفسك')
338 | set_text(LANG, 'moderation:6', '#ban: حظر بالرد')
339 | set_text(LANG, 'moderation:7', '#ban /: حظر بالمعرف او الايدي')
340 | set_text(LANG, 'moderation:8', '#unban: رفع الحظر بالرد')
341 | set_text(LANG, 'moderation:9', '#unban /: رفع الحظر بالمعرف او الايدي')
342 | set_text(LANG, 'moderation:10', '#gban: حظر عام بالرد')
343 | set_text(LANG, 'moderation:11', '#gban /: حظر عام بالمعرف او الايدي')
344 | set_text(LANG, 'moderation:12', '#ungban: رفع الحظرالعام بالرد')
345 | set_text(LANG, 'moderation:13', '#ungban /: رفع الحظر العام بالرد او المعرف')
346 | set_text(LANG, 'moderation:14', '#mute: كتم عضو بالرد')
347 | set_text(LANG, 'moderation:15', '#mute /: كتم بالمعرف او الايدي')
348 | set_text(LANG, 'moderation:16', '#unmute: رفع الكتم بالرد')
349 | set_text(LANG, 'moderation:17', '#unmute /: رفع الكتم بالمعرف او الايدي')
350 | set_text(LANG, 'moderation:18', '#rem: مسح رسالة بالرد')
351 |
352 | -- settings.lua --
353 | set_text(LANG, 'settings:0', 19)
354 | set_text(LANG, 'settings:1', '#settings stickers enable/disable: منع الملصقات')
355 | set_text(LANG, 'settings:2', '#settings links enable/disable: منع الروابط')
356 | set_text(LANG, 'settings:3', '#settings arabic enable/disable: منع العربية')
357 | set_text(LANG, 'settings:4', '#settings bots enable/disable:منع البوتات')
358 | set_text(LANG, 'settings:5', '#settings gifs enable/disable: منع الصور المتحركة')
359 | set_text(LANG, 'settings:6', '#settings photos enable/disable: منع الصور')
360 | set_text(LANG, 'settings:7', '#settings audios enable/disable: منع الصوتيات')
361 | set_text(LANG, 'settings:8', '#settings kickme enable/disable: منع الطرد التقائي')
362 | set_text(LANG, 'settings:9', '#settings spam enable/disable: منع البريد المزعج')
363 | set_text(LANG, 'settings:10', '#settings setphoto enable/disable: منع وضع صورة')
364 | set_text(LANG, 'settings:11', '#settings setname enable/disable: منع وضع اسم')
365 | set_text(LANG, 'settings:12', '#settings lockmember enable/disable: منع قفل الاعضاء')
366 | set_text(LANG, 'settings:13', '#settings floodtime : تعيين وقت التكرار')
367 | set_text(LANG, 'settings:14', '#settings maxflood : تعيين الحد الاقصى في وقت التكرار')
368 | set_text(LANG, 'settings:15', '#setname : تغيير اسم المجموعة.')
369 | set_text(LANG, 'settings:16', '#setphoto : تغيير صورة المجموعة')
370 | set_text(LANG, 'settings:17', '#lang : تغيير لغة البوت')
371 | set_text(LANG, 'settings:18', '#setlink : حفظ الرابط للمجموعة')
372 | set_text(LANG, 'settings:19', '#link: الحصول على رابط المجموعة')
373 | set_text(LANG, 'settings:20', '#settings tgservices enable/disable: مسح الرسائل عند دخول عضو جديد.')
374 |
375 | -- plugins.lua --
376 | set_text(LANG, 'plugins:0', 4)
377 | set_text(LANG, 'plugins:1', '#plugins: اظهار لائحة جميع الاضافات')
378 | set_text(LANG, 'plugins:2', '#plugins / [plugin]: تفعيل/تعطيل الاضافة المحددة')
379 | set_text(LANG, 'plugins:3', '#plugins / [plugin] chat: تفعيل/تعطيل الاضافه المحددة فقط في المجموعات')
380 | set_text(LANG, 'plugins:4', '#plugins reload: اعادة تحميل جميع الاضافات')
381 |
382 | -- version.lua --
383 | set_text(LANG, 'version:0', 1)
384 | set_text(LANG, 'version:1', '#version: اظهار اصدار البوت')
385 |
386 | -- rules.lua --
387 | set_text(LANG, 'rules:0', 1)
388 | set_text(LANG, 'rules:1', '#rules: اظهار قوانين المجموعة')
389 |
390 | if matches[1] == 'install' then
391 | return 'ℹ تم تنصيب اللغة العربية بنجاح'
392 | elseif matches[1] == 'update' then
393 | return 'ℹ️ تم تحديث اللغة العربية بنجاح'
394 | end
395 | else
396 | return "🚫 هذه الاضافة تتطلب مطور"
397 | end
398 | end
399 |
400 | return {
401 | patterns = {
402 | '[!/#](install) (arabic_lang)$',
403 | '[!/#](update) (arabic_lang)$'
404 | },
405 | run = run
406 | }
407 |
--------------------------------------------------------------------------------
/lang/galician_lang.lua:
--------------------------------------------------------------------------------
1 | ---------------------------------------------------------
2 | -- ____ ____ _____ --
3 | -- | \| _ )_ _|___ ____ __ __ --
4 | -- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
5 | -- |____/|____/ |_|\____/\_____|_/\/\_| --
6 | -- --
7 | ---------------------------------------------------------
8 | -- --
9 | -- Developers: @Josepdal & @MaSkAoS --
10 | -- Support: @Skneos, @iicc1 & @serx666 --
11 | -- --
12 | -- Translated by: @M4STER_ANGEL --
13 | -- --
14 | ---------------------------------------------------------
15 |
16 | local LANG = 'ga'
17 |
18 | local function run(msg, matches)
19 | if permissions(msg.from.id, msg.to.id, "lang_install") then
20 |
21 | -------------------------
22 | -- Translation version --
23 | -------------------------
24 | set_text(LANG, 'version', '2.1')
25 | set_text(LANG, 'versionExtended', 'Traducción na versión 2.1')
26 |
27 | -------------
28 | -- Plugins --
29 | -------------
30 |
31 | -- global plugins --
32 | set_text(LANG, 'require_sudo', 'Este plugin require privilexios sudo')
33 | set_text(LANG, 'require_admin', 'Este plugin requiere privilexios admin ou superior')
34 | set_text(LANG, 'require_mod', 'Este plugin requiere privilexios mod ou superior')
35 |
36 | -- welcome.lua
37 | set_text(LANG, 'weloff', 'Benvida actiada')
38 | set_text(LANG, 'welon', 'Benvida desactivada')
39 | set_text(LANG, 'byeon', 'Despedida activada')
40 | set_text(LANG, 'byeoff', 'Despedida desactivada')
41 | set_text(LANG, 'welcome1', 'Ola ')
42 | set_text(LANG, 'welcome2', 'Benvido a ')
43 | set_text(LANG, 'weldefault', 'A benvida é a por defecto')
44 | set_text(LANG, 'byedefault', 'A despedida é a por defecto')
45 | set_text(LANG, 'newbye', 'A despedida gardouse como')
46 | set_text(LANG, 'bye1', 'Adeus ')
47 | set_text(LANG, 'bye2', ' grazas poa túa visita')
48 | set_text(LANG, 'welnew', 'A benvida gadrouse como')
49 |
50 | -- Spam.lua --
51 | set_text(LANG, 'reportUser', 'USUARIO')
52 | set_text(LANG, 'reportReason', 'Motivo do reporte')
53 | set_text(LANG, 'reportGroup', 'Grupo')
54 | set_text(LANG, 'reportMessage', 'Mensaxe')
55 |
56 | set_text(LANG, 'allowedSpamT', 'Spam permitido neste grupo')
57 | set_text(LANG, 'allowedSpamL', 'Spam permitido neste supergrupo')
58 | set_text(LANG, 'notAllowedSpamT', 'Spam non permitido neste grupo')
59 | set_text(LANG, 'notAllowedSpamL', 'Spam non permitido neste supergrupo')
60 |
61 | -- bot.lua --
62 | set_text(LANG, 'botOn', 'Estou listo, imos alá!')
63 | set_text(LANG, 'botOff', 'Non pinto nada aquí')
64 |
65 | -- settings.lua --
66 | set_text(LANG, 'user', 'O usuario')
67 | set_text(LANG, 'isFlooding', 'está a facer flood.')
68 |
69 | set_text(LANG, 'noStickersT', 'Stickers non permitidos neste grupo.')
70 | set_text(LANG, 'noStickersL', 'Stickers non permitidos neste supergrupo.')
71 | set_text(LANG, 'stickersT', 'Stickers permitidos neste grupo.')
72 | set_text(LANG, 'stickersL', 'Stickers permitidos neste supergrupo.')
73 |
74 | set_text(LANG, 'noTgservicesT', 'Servizos de Telegram silenciados neste chat.')
75 | set_text(LANG, 'noTgservicesL', 'Servizos de Telegram silenciados neste supergrupo.')
76 | set_text(LANG, 'tgservicesT', 'Servizos de Telegram visibles neste chat.')
77 | set_text(LANG, 'tgservicesL', 'Servizos de Telegram visibles neste supergrupo.')
78 |
79 | set_text(LANG, 'gifsT', 'Gifs permitidos neste grupo.')
80 | set_text(LANG, 'gifsL', 'Gifs permitidos neste supergrupo.')
81 | set_text(LANG, 'noGifsT', 'Gifs non permitidos neste grupo.')
82 | set_text(LANG, 'noGifsL', 'Gifs non permitidos neste supergrupo.')
83 |
84 | set_text(LANG, 'photosT', 'Imaxes permitidas neste grupo.')
85 | set_text(LANG, 'photosL', 'Imaxes permitidas neste supergrupo.')
86 | set_text(LANG, 'noPhotosT', 'Imaxes non permitidas neste grupo.')
87 | set_text(LANG, 'noPhotosL', 'Imaxes non permitidas neste supergrupo.')
88 |
89 | set_text(LANG, 'arabicT', 'o árabe está permitido neste grupo.')
90 | set_text(LANG, 'arabicL', 'o árabe está permitido neste supergrupo.')
91 | set_text(LANG, 'noArabicT', 'o árabe non está permitido neste grupo.')
92 | set_text(LANG, 'noArabicL', 'o árabe non está permitido neste supergrupo.')
93 |
94 | set_text(LANG, 'audiosT', 'Audios permitidos neste grupo.')
95 | set_text(LANG, 'audiosL', 'Audios permitidos neste supergrupo.')
96 | set_text(LANG, 'noAudiosT', 'Audios non permitidos neste grupo.')
97 | set_text(LANG, 'noAudiosL', 'Audios non permitidos neste supergrupo.')
98 |
99 | set_text(LANG, 'kickmeT', 'Autoexpulsión permitida neste grupo.')
100 | set_text(LANG, 'kickmo', 'Autoexpulsión permitida neste supergrupo.')
101 | set_text(LANG, 'noKickmeT', 'Autoexpulsión non permitida neste grupo.')
102 | set_text(LANG, 'noKickmo', 'Autoexpulsión non permitida neste supergrupo.')
103 |
104 | set_text(LANG, 'floodT', 'Flood permitido neste grupo.')
105 | set_text(LANG, 'floodL', 'Flood permitido neste supergrupo.')
106 | set_text(LANG, 'noFloodT', 'Flood non permitido neste grupo.')
107 | set_text(LANG, 'noFloodL', 'Flood non permitido neste supergrupo.')
108 |
109 | set_text(LANG, 'floodTime', 'Tempo máximo de flood establecido a ')
110 | set_text(LANG, 'floodMax', 'Número máximo de mensaxes no flood establecidos a ')
111 |
112 | set_text(LANG, 'gSettings', 'Axustes do grupo')
113 | set_text(LANG, 'sSettings', 'Axustes do supergrupo')
114 |
115 | set_text(LANG, 'allowed', 'Permitido')
116 | set_text(LANG, 'noAllowed', 'Non permitido')
117 | set_text(LANG, 'noSet', 'Non establecido')
118 |
119 | set_text(LANG, 'stickers', 'Stickers')
120 | set_text(LANG, 'tgservices', 'Servizos TG')
121 | set_text(LANG, 'links', 'Enlaces')
122 | set_text(LANG, 'arabic', 'Árabe')
123 | set_text(LANG, 'bots', 'Bots')
124 | set_text(LANG, 'gifs', 'Gifs')
125 | set_text(LANG, 'photos', 'Fotos')
126 | set_text(LANG, 'audios', 'Audios')
127 | set_text(LANG, 'kickme', 'Autoexpulsión')
128 | set_text(LANG, 'spam', 'Spam')
129 | set_text(LANG, 'gName', 'Nome do grupo')
130 | set_text(LANG, 'flood', 'Flood')
131 | set_text(LANG, 'language', 'Linguaxe')
132 | set_text(LANG, 'mFlood', 'Límite de flood')
133 | set_text(LANG, 'tFlood', 'Tiempo de flood')
134 | set_text(LANG, 'setphoto', 'Establecer imaxe')
135 |
136 | set_text(LANG, 'photoSaved', 'Foto gardada!')
137 | set_text(LANG, 'photoFailed', 'Error, intentao de nuevo!')
138 | set_text(LANG, 'setPhotoAborted', 'Parando o proceso de establecer foto...')
139 | set_text(LANG, 'sendPhoto', 'Envía unha foto por favor')
140 |
141 | set_text(LANG, 'linkSaved', 'O enlace foi guardado')
142 | set_text(LANG, 'groupLink', 'Link do grupo')
143 | set_text(LANG, 'sGroupLink', 'Link do supergrupo')
144 | set_text(LANG, 'noLinkSet', 'Non hai ningún link establecido. Por favor engade un con #setlink [Link].')
145 |
146 | set_text(LANG, 'chatRename', 'Agora podes renomear o chat.')
147 | set_text(LANG, 'channoRename', 'Agora podes renomear o supergrupo.')
148 | set_text(LANG, 'notChatRename', 'Agora non podes renomear o chat.')
149 | set_text(LANG, 'notChannoRename', 'Agora non podes renomear o supergrupo.')
150 |
151 | set_text(LANG, 'lockMembersT', 'O número de membros do chat foi bloqueado.')
152 | set_text(LANG, 'lockMembersL', 'O número de membros do supergrupo foi bloqueado.')
153 |
154 | set_text(LANG, 'notLockMembersT', 'O número de membros do chat foi desbloqueado.')
155 | set_text(LANG, 'notLockMembersL', 'O número de membros do supergrupo foi desbloqueado.')
156 |
157 | set_text(LANG, 'langUpdated', 'O idioma foi cambiado a: ')
158 |
159 | set_text(LANG, 'chatUpgrade', 'Chat convertido nun supergrupo con éxito.')
160 | set_text(LANG, 'notInChann', 'Este chat xa é supergrupo')
161 | set_text(LANG, 'desChanged', 'A descripción do supergrupo foi cambiada.')
162 | set_text(LANG, 'desOnlyChannos', 'A descripción só pode ser cambiada nos supergrupos.')
163 |
164 | set_text(LANG, 'muteAll', 'Todo-los miembros están silenciados.')
165 | set_text(LANG, 'unmuteAll', 'Todo-los miembros poden falar ahora.')
166 | set_text(LANG, 'muteAllX:1', 'Este grupo foi silenciado durante')
167 | set_text(LANG, 'muteAllX:2', 'segundos.')
168 |
169 | set_text(LANG, 'createGroup:1', 'Grupo')
170 | set_text(LANG, 'createGroup:2', 'creado.')
171 | set_text(LANG, 'newGroupWocome', 'Benvido ao novo grupo.')
172 |
173 | -- export_gban.lua --
174 | set_text(LANG, 'accountsGban', 'Contas globalmente baneadas.')
175 |
176 | -- giverank.lua --
177 | set_text(LANG, 'alreadyAdmin', 'Este usuario xa é admin.')
178 | set_text(LANG, 'alreadyMod', 'Este usuario xa é mod.')
179 |
180 | set_text(LANG, 'newAdmin', 'Novo admin')
181 | set_text(LANG, 'newMod', 'Novo mod')
182 | set_text(LANG, 'nowUser', 'Agora é un usuario.')
183 |
184 | set_text(LANG, 'modList', 'Lista de Mods')
185 | set_text(LANG, 'adminList', 'Lista de Admins')
186 | set_text(LANG, 'modEmpty', 'A lista de mods está vacia neste chat.')
187 | set_text(LANG, 'adminEmpty', 'A lista de admins está vacia.')
188 |
189 | -- id.lua --
190 | set_text(LANG, 'user', 'Usuario')
191 | set_text(LANG, 'supergroupName', 'Nome do SuperGrupo')
192 | set_text(LANG, 'chatName', 'Nome do Chat')
193 | set_text(LANG, 'supergroup', 'SuperGrupo')
194 | set_text(LANG, 'chat', 'Chat')
195 |
196 | -- moderation.lua --
197 | set_text(LANG, 'userUnmuted:1', 'O usuario')
198 | set_text(LANG, 'userUnmuted:2', 'Agora pode falar.')
199 |
200 | set_text(LANG, 'userMuted:1', 'O usuario')
201 | set_text(LANG, 'userMuted:2', 'Está silenciado.')
202 |
203 | set_text(LANG, 'kickUser:1', 'Usuario')
204 | set_text(LANG, 'kickUser:2', 'Expulsado.')
205 |
206 | set_text(LANG, 'banUser:1', 'Usuario')
207 | set_text(LANG, 'banUser:2', 'Baneado.')
208 |
209 | set_text(LANG, 'unbanUser:1', 'Usuario')
210 | set_text(LANG, 'unbanUser:2', 'Está desbaneado.')
211 |
212 | set_text(LANG, 'gbanUser:1', 'Usuario')
213 | set_text(LANG, 'gbanUser:2', 'Globalmente baneado.')
214 |
215 | set_text(LANG, 'ungbanUser:1', 'Usuario')
216 | set_text(LANG, 'ungbanUser:2', 'Desbaneado globalmente.')
217 |
218 | set_text(LANG, 'addUser:1', 'Usuario')
219 | set_text(LANG, 'addUser:2', 'Engadido ao chat.')
220 | set_text(LANG, 'addUser:3', 'Engadido ao supergrupo.')
221 |
222 | set_text(LANG, 'kickmeBye', 'Adeus.')
223 |
224 | -- plugins.lua --
225 | set_text(LANG, 'plugins', 'Plugins')
226 | set_text(LANG, 'installedPlugins', 'Plugins instalados.')
227 | set_text(LANG, 'pEnabled', 'Activados.')
228 | set_text(LANG, 'pDisabled', 'Desactivados.')
229 |
230 | set_text(LANG, 'isEnabled:1', 'Plugin')
231 | set_text(LANG, 'isEnabled:2', 'está activado.')
232 |
233 | set_text(LANG, 'notExist:1', 'Plugin')
234 | set_text(LANG, 'notExist:2', 'non existe.')
235 |
236 | set_text(LANG, 'notEnabled:1', 'Plugin')
237 | set_text(LANG, 'notEnabled:2', 'non activado.')
238 |
239 | set_text(LANG, 'pNotExists', 'Non existe o plugin.')
240 |
241 | set_text(LANG, 'pDisChat:1', 'Plugin')
242 | set_text(LANG, 'pDisChat:2', 'Desactivado neste chat.')
243 |
244 | set_text(LANG, 'anyDisPlugin', 'Non hai plugins desactivados.')
245 | set_text(LANG, 'anyDisPluginChat', 'Non hai plugins desactivados neste chat.')
246 | set_text(LANG, 'notDisabled', 'Este plugin non está desactivado')
247 |
248 | set_text(LANG, 'enabledAgain:1', 'Plugin')
249 | set_text(LANG, 'enabledAgain:2', 'Está activado de novo')
250 |
251 | -- commands.lua --
252 | set_text(LANG, 'commandsT', 'Comandos')
253 | set_text(LANG, 'errorNoPlug', 'Este plugin non existe ou non ten comandos.')
254 |
255 | -- rules.lua --
256 | set_text(LANG, 'setRules', 'As regras do chat foron actualizadas.')
257 | set_text(LANG, 'remRules', 'As regras do chat foron quitadas.')
258 |
259 |
260 | ------------
261 | -- Usages --
262 | ------------
263 |
264 | -- bot.lua --
265 | set_text(LANG, 'bot:0', 2)
266 | set_text(LANG, 'bot:1', '#bot on: activa o bot no chat actual.')
267 | set_text(LANG, 'bot:2', '#bot off: desactiva o bot no chat actual.')
268 |
269 | -- commands.lua --
270 | set_text(LANG, 'commands:0', 2)
271 | set_text(LANG, 'commands:1', '#commands: Mostra os comandos para todo-los plugins.')
272 | set_text(LANG, 'commands:2', '#commands [plugin]: Comandos para ese plugin.')
273 |
274 | -- export_gban.lua --
275 | set_text(LANG, 'export_gban:0', 2)
276 | set_text(LANG, 'export_gban:1', '#gbans installer: Devolve un archivo .lua instalador para compartir gbans y engadilos noutro bot coun único comando.')
277 | set_text(LANG, 'export_gban:2', '#gbans list: Devolve un archivo coa lista de gbans.')
278 |
279 | -- gban_installer.lua --
280 | set_text(LANG, 'gban_installer:0', 1)
281 | set_text(LANG, 'gban_installer:1', '#install gbans: engade unha lista de gbans na tua base de datos redis.')
282 |
283 | -- giverank.lua --
284 | set_text(LANG, 'giverank:0', 9)
285 | set_text(LANG, 'giverank:1', '#rank admin (reply): convirte a persoa á que respondes nun admin.')
286 | set_text(LANG, 'giverank:2', '#rank admin /: engade un admin mediante o seu ID/Alias.')
287 | set_text(LANG, 'giverank:3', '#rank mod (reply): convirte a persona á que respondes nun mod.')
288 | set_text(LANG, 'giverank:4', '#rank mod /: engade un mod mediante su ID/Alias.')
289 | set_text(LANG, 'giverank:5', '#rank guest (reply): borra de admin á persona que respondes.')
290 | set_text(LANG, 'giverank:6', '#rank guest /: borra un admin mediante su ID/Alias.')
291 | set_text(LANG, 'giverank:7', '#admins: lista de todo-los admins.')
292 | set_text(LANG, 'giverank:8', '#mods: lista de todo-los mods do chat.')
293 | set_text(LANG, 'giverank:9', '#members: lista de todo-los miembros do chat.')
294 |
295 | -- id.lua --
296 | set_text(LANG, 'id:0', 6)
297 | set_text(LANG, 'id:1', '#id: devolve a tu id e a do chat se estás nalgún.')
298 | set_text(LANG, 'id:2', '#ids chat: devolve as IDs dos membros actuales no grupo.')
299 | set_text(LANG, 'id:3', '#ids channo: devolve as IDs dos membros actuales no supergrupo.')
300 | set_text(LANG, 'id:4', '#id : devolve a ID do usuario presente no chat.')
301 | set_text(LANG, 'id:5', '#whois /: Devolve o ID/Alias do usuario.')
302 | set_text(LANG, 'id:6', '#whois (reply): Devolve a ID do usuario.')
303 |
304 | -- moderation.lua --
305 | set_text(LANG, 'moderation:0', 18)
306 | set_text(LANG, 'moderation:1', '#add: respondendo a unha mensaxe, engadirá a ese usuario ao grupo ou supergrupo actual.')
307 | set_text(LANG, 'moderation:2', '#add /: engadirá a un usuario, polo su ID/Alias, ao grupo ou supergrupo actual.')
308 | set_text(LANG, 'moderation:3', '#kick: respondendo a unha mensaxe, expulsará a ese usuario do grupo ou supergrupo actual.')
309 | set_text(LANG, 'moderation:4', '#kick /: expulsa a un usuario, polo su ID/Alias, do grupo ou supergrupo actual.')
310 | set_text(LANG, 'moderation:5', '#kickme: expúlsame do grupo.')
311 | set_text(LANG, 'moderation:6', '#ban: respondendo a unha mensaxe, expulsará e baneará a ese usuario do grupo ou supergrupo actual.')
312 | set_text(LANG, 'moderation:7', '#ban /: expulsa a un usuario, polo su ID/Alias, e impide que este vuova a entrar ao grupo ou supergrupo actual.')
313 | set_text(LANG, 'moderation:8', '#unban: respondendo a unha mensaxe, desbanea a ese usuario do grupo ou supergrupo.')
314 | set_text(LANG, 'moderation:9', '#unban /: desbanea a ese usuario polo su ID/Alias do grupo ou supergrupo.')
315 | set_text(LANG, 'moderation:10', '#gban: respondendo a unha mensaxe, o usuario será baneado de todo-los grupos e/o supergrupos.')
316 | set_text(LANG, 'moderation:11', '#gban /: expulsa e banea al usuario, polo seu ID/alias, de todo-los grupos e/o supergrupos e impide que este volva a entrar en todo-los grupos e/o supergrupos.')
317 | set_text(LANG, 'moderation:12', '#ungban: respondendo a unha mensaxe, quita o baneo de todo-los grupos e/o supergrupos.')
318 | set_text(LANG, 'moderation:13', '#ungban /: quita o baneo ao usuario, polo seu ID/alias, de todo-los grupos e/o supergrupos.')
319 | set_text(LANG, 'moderation:14', '#mute: respondendo a unha mensaxe, silencia ao usuario eliminando sus mensaxes no supergrupo actual.')
320 | set_text(LANG, 'moderation:15', '#mute /: silencia a un usuario, polo seu ID/alias, eliminando as suas mensaxes no supergrupo actual.')
321 | set_text(LANG, 'moderation:16', '#unmute: respondendo a un mensaxe, quita o silencio al usuario.')
322 | set_text(LANG, 'moderation:17', '#unmute /: quita o silencio ao usuario, polo seu ID/alias, no supergrupo actual.')
323 | set_text(LANG, 'moderation:18', '#rem: respondendo a unha mensaxe, esa mensaxe será borrada.')
324 |
325 | -- settings.lua --
326 | set_text(LANG, 'settings:0', 20)
327 | set_text(LANG, 'settings:1', '#settings stickers enable/disable: poderás mandar stickers cando estea activo.')
328 | set_text(LANG, 'settings:2', '#settings links enable/disable: poderás mandar links cuando estea activo.')
329 | set_text(LANG, 'settings:3', '#settings arabic enable/disable: poderás falar en árabe/persa cando estea activo.')
330 | set_text(LANG, 'settings:4', '#settings bots enable/disable: poderás engadir bots ao chat cando estea activo.')
331 | set_text(LANG, 'settings:5', '#settings gifs enable/disable: poderás mandar gifs cando estea activo.')
332 | set_text(LANG, 'settings:6', '#settings photos enable/disable: poderás mandar imaxes cando estea activo.')
333 | set_text(LANG, 'settings:7', '#settings audios enable/disable: poderás mandar audios cando estea activo.')
334 | set_text(LANG, 'settings:8', '#settings kickme enable/disable: os usuarios poderán autoexpulsarse cando estea activo.')
335 | set_text(LANG, 'settings:9', '#settings spam enable/disable: poderás mandar enlaces de spam (telegram.me) cando estea activo.')
336 | set_text(LANG, 'settings:10', '#settings setphoto enable/disable: se un usuario cambia a foto do grupo, o bot cambiarana pola foto gardada cando estea activo.')
337 | set_text(LANG, 'settings:11', '#settings setname enable/disable: se un usuario cambia o nome do grupo, o bot cambiarano polo nome gardado cando estea activo.')
338 | set_text(LANG, 'settings:12', '#settings lockmember enable/disable: o bot expulsará a toda-la xente que entre ao grupo cuando estea activo.')
339 | set_text(LANG, 'settings:13', '#settings floodtime : establece o tiempo de medición do flood.')
340 | set_text(LANG, 'settings:14', '#settings maxflood : establece o máximo de mensaxes nun floodtime para ser considerado flood.')
341 | set_text(LANG, 'settings:15', '#setname : o bot cambiará o nome do grupo.')
342 | set_text(LANG, 'settings:16', '#setphoto : o bot cambiará la foto do grupo.')
343 | set_text(LANG, 'settings:17', '#lang : cambia o idioma do bot.')
344 | set_text(LANG, 'settings:18', '#setlink : garda o link do grupo.')
345 | set_text(LANG, 'settings:19', '#link: mostra o link do grupo.')
346 | set_text(LANG, 'settings:20', '#settings tgservices enable/disable: borra todo-las mensaxes de Telegram dun novo participante no supergrupo cuando estea activo.')
347 |
348 | -- plugins.lua --
349 | set_text(LANG, 'plugins:0', 4)
350 | set_text(LANG, 'plugins:1', '#plugins: mostra unha lista de todos os plugins.')
351 | set_text(LANG, 'plugins:2', '#plugins / [plugin]: activa/desactiva o plugin especificado.')
352 | set_text(LANG, 'plugins:3', '#plugins / [plugin] chat: activa/desactiva o plugin especificado, solo no grupo/supergrupo actual.')
353 | set_text(LANG, 'plugins:4', '#plugins rooad: recarga todos los plugins.')
354 |
355 | -- version.lua --
356 | set_text(LANG, 'version:0', 1)
357 | set_text(LANG, 'version:1', '#version: mostra a versión do bot.')
358 |
359 | -- version.lua --
360 | set_text(LANG, 'rules:0', 1)
361 | set_text(LANG, 'rules:1', '#rules: mostra as regras do chat.')
362 |
363 | if matches[1] == 'install' then
364 | return 'A linguaxe galego foi instalada na sua base de datos.'
365 | elseif matches[1] == 'update' then
366 | return 'A linguaxe galego foi actualizada na sua base de datos.'
367 | end
368 | else
369 | return "Este plugin require permisos sudo."
370 | end
371 | end
372 |
373 | return {
374 | patterns = {
375 | '[!/#](install) (galician_lang)$',
376 | '[!/#](update) (galician_lang)$'
377 | },
378 | run = run,
379 | }
380 |
--------------------------------------------------------------------------------
/lang/portuguese_lang.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------
2 | -- ____ ____ _____ --
3 | -- | \| _ )_ _|___ ____ __ __ --
4 | -- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
5 | -- |____/|____/ |_|\____/\_____|_/\/\_| --
6 | -- --
7 | --------------------------------------------------
8 | -- --
9 | -- Developers: @Josepdal & @MaSkAoS --
10 | -- Support: @iicc1, @serx666 & @Skneos --
11 | -- --
12 | -- Translated by: @TiagoDanin & @Wesley_Henr --
13 | -- --
14 | --------------------------------------------------
15 |
16 | local LANG = 'pt'
17 |
18 | local function run(msg, matches)
19 | if permissions(msg.from.id, msg.to.id, "lang_install") then
20 |
21 | -------------------------
22 | -- Translation version --
23 | -------------------------
24 | set_text(LANG, 'version', '0.1')
25 | set_text(LANG, 'versionExtended', 'Tradução versão 0.1')
26 |
27 | -------------
28 | -- Plugins --
29 | -------------
30 |
31 | -- global plugins --
32 | set_text(LANG, 'require_sudo', 'Este plugin requer privilégios sudo.')
33 | set_text(LANG, 'require_admin', 'Este plugin requer privilégios admin ou superior')
34 | set_text(LANG, 'require_mod', 'Este plugin requer privilégios mod ou superior')
35 |
36 | -- welcome.lua
37 | set_text(LANG, 'weloff', 'Bemvinda ativada.')
38 | set_text(LANG, 'welon', 'Bemvinda desativada')
39 | set_text(LANG, 'byeon', 'Despedida ativada.')
40 | set_text(LANG, 'byeoff', 'Despedida desativada.')
41 | set_text(LANG, 'welcome1', 'Olá ')
42 | set_text(LANG, 'welcome2', 'bemvindo para ')
43 | set_text(LANG, 'weldefault', 'Bemvinda ativada é o omissão.')
44 | set_text(LANG, 'byedefault', 'Despedida ativada é o omissão.')
45 | set_text(LANG, 'newbye', 'Despedida salva. é:')
46 | set_text(LANG, 'bye1', 'Adeus ')
47 | set_text(LANG, 'bye2', ' obrigado por a visita.')
48 | set_text(LANG, 'welnew', 'Bemvinda salva. é:')
49 |
50 | -- Spam.lua --
51 | set_text(LANG, 'reportUser', 'USUÁRIO')
52 | set_text(LANG, 'reportReason', 'Razão do reporte')
53 | set_text(LANG, 'reportGroup', 'Grupo')
54 | set_text(LANG, 'reportMessage', 'Mensagem')
55 |
56 | set_text(LANG, 'allowedSpamT', 'Spam é permitido neste grupo')
57 | set_text(LANG, 'allowedSpamL', 'Spam é permitido neste supergrupo')
58 | set_text(LANG, 'notAllowedSpamT', 'Não é permitido spam neste grupo')
59 | set_text(LANG, 'notAllowedSpamL', 'Não é permitido spam neste supergrupo')
60 |
61 | -- bot.lua --
62 | set_text(LANG, 'botOn', 'Estou de volta. Aqui vamos nós')
63 | set_text(LANG, 'botOff', 'Nada para fazer aqui')
64 |
65 | -- settings.lua --
66 | set_text(LANG, 'user', 'O usuário')
67 | set_text(LANG, 'isFlooding', 'está floodando.')
68 |
69 | set_text(LANG, 'stickersT', 'Stickers são permitidos neste grupo.')
70 | set_text(LANG, 'stickersL', 'Stickers são permitidos neste supergrupo.')
71 | set_text(LANG, 'noStickersT', 'Stickers não são permitidos neste grupo.')
72 | set_text(LANG, 'noStickersL', 'Stickers não são permitidos neste supergrupo.')
73 |
74 | set_text(LANG, 'noTgservicesT', 'Os Serviços do Telegram foram silenciados neste grupo.')
75 | set_text(LANG, 'noTgservicesL', 'Os Serviços do Telegram foram silenciados neste supergrupo.')
76 | set_text(LANG, 'tgservicesT', 'Os Serviços do Telegram foram permitidos neste grupo.')
77 | set_text(LANG, 'tgservicesL', 'Os Serviços do Telegram foram permitidos neste supergrupo.')
78 |
79 |
80 | set_text(LANG, 'LinksT', 'Os links são permitidos no grupo.')
81 | set_text(LANG, 'LinksL', 'Os links são permitidos no supergrupo.')
82 | set_text(LANG, 'noLinksT', 'Os links não são permitidos no grupo.')
83 | set_text(LANG, 'noLinksL', 'Os links não são permitidos no supergrupo.')
84 |
85 | set_text(LANG, 'gifsT', 'Gifs são permitidos neste grupo.')
86 | set_text(LANG, 'gifsL', 'Gifs são permitidos neste supergrupo.')
87 | set_text(LANG, 'noGifsT', 'Gifs não são permitidos neste grupo.')
88 | set_text(LANG, 'noGifsL', 'Gifs não são permitidos neste supergrupo.')
89 |
90 | set_text(LANG, 'photosT', 'Fotos são permitidas neste grupo.')
91 | set_text(LANG, 'photosL', 'Fotos são permitidas neste supergrupo.')
92 | set_text(LANG, 'noPhotosT', 'Fotos não são permitidas neste grupo.')
93 | set_text(LANG, 'noPhotosL', 'Fotos não são permitidas neste supergrupo.')
94 |
95 | set_text(LANG, 'botsT', 'Bots são permitidos neste grupo.')
96 | set_text(LANG, 'botsL', 'Bots são permitidos neste supergrupo.')
97 | set_text(LANG, 'noBotsT', 'Bots não são permitidos neste grupo.')
98 | set_text(LANG, 'noBotsL', 'Bots não são permitidos neste supergrupo.')
99 |
100 | set_text(LANG, 'arabicT', 'Caracteres especiais árabes são permitidos neste grupo.')
101 | set_text(LANG, 'arabicL', 'Caracteres especiais árabes são permitidos neste supergrupo.')
102 | set_text(LANG, 'noArabicT', 'Caracteres especiais árabes não são permitidos neste grupo.')
103 | set_text(LANG, 'noArabicL', 'Caracteres especiais árabes não são permitidos neste supergrupo.')
104 |
105 | set_text(LANG, 'audiosT', 'Áudios são permitidos neste grupo.')
106 | set_text(LANG, 'audiosL', 'Áudios são permitidos neste supergrupo.')
107 | set_text(LANG, 'noAudiosT', 'Áudios não são permitidos neste grupo.')
108 | set_text(LANG, 'noAudiosL', 'Áudios não são permitidos neste supergrupo.')
109 |
110 | set_text(LANG, 'kickmeT', 'Autokick permitido neste grupo.')
111 | set_text(LANG, 'kickmeL', 'Autokick permitido neste supergrupo.')
112 | set_text(LANG, 'noKickmeT', 'Autokick não é permitido neste grupo.')
113 | set_text(LANG, 'noKickmeL', 'Autokick não é permitido neste supergrupo.')
114 |
115 | set_text(LANG, 'floodT', 'Flood permitido neste grupo.')
116 | set_text(LANG, 'floodL', 'Flood permitido neste supergrupo.')
117 | set_text(LANG, 'noFloodT', 'Não é permitido flood neste grupo.')
118 | set_text(LANG, 'noFloodL', 'Não é permitido flood neste supergrupo.')
119 |
120 | set_text(LANG, 'floodTime', 'Tempo máximo de flood estabelecido para ')
121 | set_text(LANG, 'floodMax', 'Número máximo de mensagens flood estabelecido para ')
122 |
123 | set_text(LANG, 'gSettings', 'Configurações do grupo')
124 | set_text(LANG, 'sSettings', 'Configurações do supergrupo')
125 |
126 | set_text(LANG, 'allowed', 'permitido')
127 | set_text(LANG, 'noAllowed', 'não permitido')
128 | set_text(LANG, 'noSet', 'não estabelecido')
129 |
130 | set_text(LANG, 'stickers', 'Stickers')
131 | set_text(LANG, 'tgservices', 'Tg services')
132 | set_text(LANG, 'links', 'Links')
133 | set_text(LANG, 'arabic', 'Árabe')
134 | set_text(LANG, 'bots', 'Bots')
135 | set_text(LANG, 'gifs', 'Gifs')
136 | set_text(LANG, 'photos', 'Fotos')
137 | set_text(LANG, 'audios', 'Áudios')
138 | set_text(LANG, 'kickme', 'Autokick')
139 | set_text(LANG, 'spam', 'Spam')
140 | set_text(LANG, 'gName', 'Nome do grupo')
141 | set_text(LANG, 'flood', 'Flood')
142 | set_text(LANG, 'language', 'Idioma')
143 | set_text(LANG, 'mFlood', 'Limite de flood')
144 | set_text(LANG, 'tFlood', 'Tempo de flood')
145 | set_text(LANG, 'setphoto', 'Definir foto')
146 |
147 | set_text(LANG, 'photoSaved', 'Foto salva!')
148 | set_text(LANG, 'photoFailed', 'Erro, tente novamente!')
149 | set_text(LANG, 'setPhotoAborted', 'Parando processo de definir a foto...')
150 | set_text(LANG, 'sendPhoto', 'Por favor, envie uma foto')
151 |
152 | set_text(LANG, 'chatSetphoto', 'Agora você pode ajustar a foto neste grupo.')
153 | set_text(LANG, 'channelSetphoto', 'Agora você pode ajustar a foto neste supergrupo.')
154 | set_text(LANG, 'notChatSetphoto', 'Agora você não pode ajustar foto neste grupo.')
155 | set_text(LANG, 'notChannelSetphoto', 'Agora você não pode ajustar foto neste supergrupo.')
156 | set_text(LANG, 'setPhotoError', 'Por favor, habilite a configuração do setphoto.')
157 |
158 | set_text(LANG, 'linkSaved', 'Novo Link salvo')
159 | set_text(LANG, 'groupLink', 'Link do grupo')
160 | set_text(LANG, 'sGroupLink', 'Link do supergrupo')
161 | set_text(LANG, 'noLinkSet', 'Não há nenhum link estabelecido. Por favor crie um novo com #setlink [Link].')
162 |
163 | set_text(LANG, 'chatRename', 'Agora você pode renomear o grupo.')
164 | set_text(LANG, 'channelRename', 'Agora você pode renomear o supergrupo.')
165 | set_text(LANG, 'notChatRename', 'Agora você não pode renomear o grupo.')
166 | set_text(LANG, 'notChannelRename', 'Agora você não pode renomear o supergrupo.')
167 |
168 | set_text(LANG, 'lockMembersT', 'O Número de membros do grupo foi bloqueado.')
169 | set_text(LANG, 'lockMembersL', 'O Número de membros do supergrupo foi bloqueado.')
170 |
171 | set_text(LANG, 'notLockMembersT', 'Número de membros do grupo foi desbloqueado.')
172 | set_text(LANG, 'notLockMembersL', 'Número de membros do supergrupo foi desbloqueado.')
173 |
174 | set_text(LANG, 'langUpdated', 'Seu idioma foi atualizado para: ')
175 |
176 | -- export_gban.lua --
177 | set_text(LANG, 'accountsGban', 'contas globalmente banidas.')
178 |
179 | -- giverank.lua --
180 | set_text(LANG, 'alreadyAdmin', 'Este usuário é um admin.')
181 | set_text(LANG, 'alreadyMod', 'Este usuário é um mod.')
182 |
183 | set_text(LANG, 'newAdmin', 'Novo admin')
184 | set_text(LANG, 'newMod', 'Novo mod')
185 | set_text(LANG, 'nowUser', 'agora é um usuário.')
186 |
187 | set_text(LANG, 'modList', 'Lista de Mods')
188 | set_text(LANG, 'adminList', 'Lista de Admins')
189 | set_text(LANG, 'modEmpty', 'A lista mods está vazia neste grupo.')
190 | set_text(LANG, 'adminEmpty', 'A lista de admins está vazia.')
191 |
192 | -- id.lua --
193 | set_text(LANG, 'user', 'Usuário')
194 | set_text(LANG, 'supergroupName', 'Nome do SuperGrupo')
195 | set_text(LANG, 'chatName', 'Nome do Grupo')
196 | set_text(LANG, 'supergroup', 'SuperGrupo')
197 | set_text(LANG, 'chat', 'Grupo')
198 |
199 | -- moderation.lua --
200 | set_text(LANG, 'userUnmuted:1', 'Usuário')
201 | set_text(LANG, 'userUnmuted:2', 'permitido para falar.')
202 |
203 | set_text(LANG, 'userMuted:1', 'Usuário')
204 | set_text(LANG, 'userMuted:2', 'silenciado.')
205 |
206 | set_text(LANG, 'kickUser:1', 'Usuário')
207 | set_text(LANG, 'kickUser:2', 'expulso.')
208 |
209 | set_text(LANG, 'banUser:1', 'Usuário')
210 | set_text(LANG, 'banUser:2', 'banido.')
211 |
212 | set_text(LANG, 'unbanUser:1', 'Usuário')
213 | set_text(LANG, 'unbanUser:2', 'desbanido.')
214 |
215 | set_text(LANG, 'gbanUser:1', 'Usuário')
216 | set_text(LANG, 'gbanUser:2', 'banido globalmente.')
217 |
218 | set_text(LANG, 'ungbanUser:1', 'Usuário')
219 | set_text(LANG, 'ungbanUser:2', 'desbanido globalmente.')
220 |
221 | set_text(LANG, 'addUser:1', 'Usuário')
222 | set_text(LANG, 'addUser:2', 'adicionado ao grupo.')
223 | set_text(LANG, 'addUser:3', 'adicionado ao supergrupo.')
224 |
225 | set_text(LANG, 'kickmeBye', 'tchau.')
226 |
227 | -- plugins.lua --
228 | set_text(LANG, 'plugins', 'Plugins')
229 | set_text(LANG, 'installedPlugins', 'plugins instalados.')
230 | set_text(LANG, 'pEnabled', 'ativados.')
231 | set_text(LANG, 'pDisabled', 'desativados.')
232 |
233 | set_text(LANG, 'isEnabled:1', 'Plugin')
234 | set_text(LANG, 'isEnabled:2', 'está ativado.')
235 |
236 | set_text(LANG, 'notExist:1', 'Plugin')
237 | set_text(LANG, 'notExist:2', 'não existe.')
238 |
239 | set_text(LANG, 'notEnabled:1', 'Plugin')
240 | set_text(LANG, 'notEnabled:2', 'não ativado.')
241 |
242 | set_text(LANG, 'pNotExists', 'Não existe esse plugin.')
243 |
244 | set_text(LANG, 'pDisChat:1', 'Plugin')
245 | set_text(LANG, 'pDisChat:2', 'desativado neste grupo.')
246 |
247 | set_text(LANG, 'anyDisPlugin', 'Não há plugins desativados.')
248 | set_text(LANG, 'anyDisPluginChat', 'Não há plugins desativado neste grupo.')
249 | set_text(LANG, 'notDisabled', 'Este plugin não está desativado')
250 |
251 | set_text(LANG, 'enabledAgain:1', 'Plugin')
252 | set_text(LANG, 'enabledAgain:2', 'está ativado denovo')
253 |
254 | -- commands.lua --
255 | set_text(LANG, 'commandsT', 'Comandos')
256 | set_text(LANG, 'errorNoPlug', 'Este plugin não existe ou não está em uso.')
257 |
258 | -- rules.lua --
259 | set_text(LANG, 'setRules', 'As regras do grupo foram atualizadas.')
260 | set_text(LANG, 'remRules', 'As regras do grupo foram removidas.')
261 |
262 | ------------
263 | -- Usages --
264 | ------------
265 |
266 | -- bot.lua --
267 | set_text(LANG, 'bot:0', 2)
268 | set_text(LANG, 'bot:1', '#bot on: Ativa o bot no grupo atual.')
269 | set_text(LANG, 'bot:2', '#bot off: Desativa o bot no grupo atual.')
270 |
271 | -- commands.lua --
272 | set_text(LANG, 'commands:0', 2)
273 | set_text(LANG, 'commands:1', '#commands: Mostrar todos os comandos de cada plugin.')
274 | set_text(LANG, 'commands:2', '#commands [plugin]: Comandos para este plugin.')
275 |
276 | -- export_gban.lua --
277 | set_text(LANG, 'export_gban:0', 2)
278 | set_text(LANG, 'export_gban:1', '#gbans installer: Retorna um arquivo instalador lua para compartilhar gbans e adicionar outro bot com um único comando.')
279 | set_text(LANG, 'export_gban:2', '#gbans list: Retorna uma lista de arquivos gbans.')
280 |
281 | -- gban_installer.lua --
282 | set_text(LANG, 'gban_installer:0', 1)
283 | set_text(LANG, 'gban_installer:1', '#install gbans: Acrescenta uma lista de gbans em seu redis de banco de dados.')
284 |
285 | -- giverank.lua --
286 | set_text(LANG, 'giverank:0', 9)
287 | set_text(LANG, 'giverank:1', '#rank admin (reply): Adicionar admin respondendo.')
288 | set_text(LANG, 'giverank:2', '#rank admin /: Adicionar admin pelo ID/Nome de Usuário.')
289 | set_text(LANG, 'giverank:3', '#rank mod (reply): Adicionar mod respondendo.')
290 | set_text(LANG, 'giverank:4', '#rank mod /: Adicionar mod pelo ID/Nome de Usuário.')
291 | set_text(LANG, 'giverank:5', '#rank guest (reply): Remover mod/admin respondendo.')
292 | set_text(LANG, 'giverank:6', '#rank guest /: Remover mod/admin pelo ID/Nome de Usuário.')
293 | set_text(LANG, 'giverank:7', '#admins: Lista de todos os admins.')
294 | set_text(LANG, 'giverank:8', '#mods: Lista de todos os mods.')
295 | set_text(LANG, 'giverank:9', '#members: Lista de todos os membros do grupo.')
296 |
297 | -- id.lua --
298 | set_text(LANG, 'id:0', 6)
299 | set_text(LANG, 'id:1', '#id: Retorna o seu ID e do grupo se você estiver em algum.')
300 | set_text(LANG, 'id:2', '#ids chat: Retorna com as IDs dos membros atuais do grupo.')
301 | set_text(LANG, 'id:3', '#ids channel: Retorna com as IDs dos membros atuais do supergrupo.')
302 | set_text(LANG, 'id:4', '#id : Retorna o ID membro do nome de usuário do bate-papo atual.')
303 | set_text(LANG, 'id:5', '#whois /: Retorna o nome de usuário.')
304 | set_text(LANG, 'id:6', '#whois (reply): Retorna o ID do usuário.')
305 |
306 | -- moderation.lua --
307 | set_text(LANG, 'moderation:0', 18)
308 | set_text(LANG, 'moderation:1', '#add: Respondendo a uma mensagem, adicionar esse usuário ao grupo ou supergrupo atual.')
309 | set_text(LANG, 'moderation:2', '#add /: Adiciona um usuário, por ID/, ao grupo atual ou supergrupo.')
310 | set_text(LANG, 'moderation:3', '#kick: Respondendo a uma mensagem, removerá o usuário do grupo atual ou supergrupo.')
311 | set_text(LANG, 'moderation:4', '#kick /: Remove o usuário, por sua ID/, do grupo ou supergrupo atual.')
312 | set_text(LANG, 'moderation:5', '#kickme: Sair.')
313 | set_text(LANG, 'moderation:6', '#ban: Respondendo a uma mensagem, removerá e banir o usuário do grupo ou supergrupo atual.')
314 | set_text(LANG, 'moderation:7', '#ban /: Remove o usuário, por seu ID/, e impede que ele volte a entrar no grupo ou supergrupo.')
315 | set_text(LANG, 'moderation:8', '#unban: Respondendo a uma mensagem, desbane o usuário do grupo ou supergrupo.')
316 | set_text(LANG, 'moderation:9', '#unban /: Desbane o usuário por sua ID/ do grupo ou supergrupo.')
317 | set_text(LANG, 'moderation:10', '#gban: Respondendo a uma mensagem, o usuário será banido de todos os grupos e supergrupos.')
318 | set_text(LANG, 'moderation:11', '#gban /: Remove e bane o usuário, por sua ID/, de todos os grupos ou supergrupos e impede que ele volte a entrar em todos os grupos ou supergrupos.')
319 | set_text(LANG, 'moderation:12', '#ungban: Respondendo a um mensagem, desbane o usuário de todos os grupos ou supergrupos.')
320 | set_text(LANG, 'moderation:13', '#ungban /: Desbane o usuário, por sua ID/, de todos os grupos ou supergrupos.')
321 | set_text(LANG, 'moderation:14', '#mute: Respondendo a uma mensagem, silencia o usuário eliminando suas mensagens do supergrupo atual.')
322 | set_text(LANG, 'moderation:15', '#mute /: silencia o usuário, por sua ID/, eliminando sua mensagens no supergrupo atual.')
323 | set_text(LANG, 'moderation:16', '#unmute: Respondendo a uma mensagem, retira o silencio do usuário.')
324 | set_text(LANG, 'moderation:17', '#unmute /: Remove o silênciodo do usuário por sua ID/ do supergrupo atual.')
325 | set_text(LANG, 'moderation:18', '#rem: Respondendo a uma mensagem, essa mensagem será apagada.')
326 |
327 | -- settings.lua --
328 | set_text(LANG, 'settings:0', 20)
329 | set_text(LANG, 'settings:1', '#settings stickers enable/disable: Você pode enviar stickers quando ativo.')
330 | set_text(LANG, 'settings:2', '#settings links enable/disable: Poderá mandar links quando estiver ativo.')
331 | set_text(LANG, 'settings:3', '#settings arabic enable/disable: Poderá falar em árabe/persa quando estiver ativo.')
332 | set_text(LANG, 'settings:4', '#settings bots enable/disable: Poderá adicionar bots ao grupo quando estiver ativo.')
333 | set_text(LANG, 'settings:5', '#settings gifs enable/disable: Poderá mandar gifs quando estiver ativo.')
334 | set_text(LANG, 'settings:6', '#settings photos enable/disable: Poderá mandar fotos quando estiver ativo.')
335 | set_text(LANG, 'settings:7', '#settings audios enable/disable: Poderá mandar audios quando estiver ativo.')
336 | set_text(LANG, 'settings:8', '#settings kickme enable/disable: Os usuários poderão usar o /kickme quando estiver ativo.')
337 | set_text(LANG, 'settings:9', '#settings spam enable/disable: Poderá mandar spam quando estiver ativo.')
338 | set_text(LANG, 'settings:10', '#settings setphoto enable/disable: Se um usuário alterar a foto do grupo, o botão irá mudar a imagem salva quando ativo.')
339 | set_text(LANG, 'settings:11', '#settings setname enable/disable: Se um usuário muda o nome do grupo, o bot irá mudar o nome salvo quando ativo.')
340 | set_text(LANG, 'settings:12', '#settings lockmember enable/disable: O bot irá expulsar todas as pessoas entre o grupo quando ativo.')
341 | set_text(LANG, 'settings:13', '#settings floodtime : Ele define o tempo de medição de flood.')
342 | set_text(LANG, 'settings:14', '#settings maxflood : Define a mensagem máximo em um tempo de floodtempo devem ser considerados flood.')
343 | set_text(LANG, 'settings:15', '#setname : O bot renomeia o nome do grupo.')
344 | set_text(LANG, 'settings:16', '#setphoto : O bot muda a foto do grupo.')
345 | set_text(LANG, 'settings:17', '#lang : Altera o idioma do bot.')
346 | set_text(LANG, 'settings:18', '#setlink : Gera link do grupo.')
347 | set_text(LANG, 'settings:19', '#link: Mostra link do grupo.')
348 | set_text(LANG, 'settings:20', '#settings tgservices enable/disable: Quando desativado, a notificação de um novo participante será apagado.')
349 |
350 | -- plugins.lua --
351 | set_text(LANG, 'plugins:0', 4)
352 | set_text(LANG, 'plugins:1', '#plugins: Mostra uma lista de todos os plugins.')
353 | set_text(LANG, 'plugins:2', '#plugins / [plugin]: Ativa/desativa o plugin especificado.')
354 | set_text(LANG, 'plugins:3', '#plugins / [plugin] chat: Ativa/desativa o plugin especificado, apenas no actual grupo/supergrupo.')
355 | set_text(LANG, 'plugins:4', '#plugins reload: Recarega todos os plugins.')
356 |
357 | -- version.lua --
358 | set_text(LANG, 'version:0', 1)
359 | set_text(LANG, 'version:1', '#version: Mostra a versão do bot.')
360 |
361 | -- version.lua --
362 | set_text(LANG, 'rules:0', 1)
363 | set_text(LANG, 'rules:1', '#rules: Mostra as regras do grupo.')
364 |
365 | if matches[1] == 'install' then
366 | return 'ℹ️ O idioma português foi instalado no seu banco de dados.'
367 | elseif matches[1] == 'update' then
368 | return 'ℹ️ O idioma português foi atualizado no seu banco de dados.'
369 | end
370 | else
371 | return "🚫 Este plugin requer permissões de sudo."
372 | end
373 | end
374 |
375 | return {
376 | patterns = {
377 | '[!/#](install) (portuguese_lang)$',
378 | '[!/#](update) (portuguese_lang)$'
379 | },
380 | run = run,
381 | }
382 |
--------------------------------------------------------------------------------
/launch.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | THIS_DIR=$(cd $(dirname $0); pwd)
4 | cd $THIS_DIR
5 |
6 | update() {
7 | git pull
8 | git submodule update --init --recursive
9 | install_rocks
10 | }
11 |
12 | # Will install luarocks on THIS_DIR/.luarocks
13 | install_luarocks() {
14 | git clone https://github.com/keplerproject/luarocks.git
15 | cd luarocks
16 | git checkout tags/v2.3.0-rc2 # Release Candidate
17 |
18 | PREFIX="$THIS_DIR/.luarocks"
19 |
20 | ./configure --prefix=$PREFIX --sysconfdir=$PREFIX/luarocks --force-config
21 |
22 | RET=$?; if [ $RET -ne 0 ];
23 | then echo "Error. Exiting."; exit $RET;
24 | fi
25 |
26 | make build && make install
27 | RET=$?; if [ $RET -ne 0 ];
28 | then echo "Error. Exiting.";exit $RET;
29 | fi
30 |
31 | cd ..
32 | rm -rf luarocks
33 | }
34 |
35 | install_rocks() {
36 | ./.luarocks/bin/luarocks install luasec
37 | RET=$?; if [ $RET -ne 0 ];
38 | then echo "Error. Exiting."; exit $RET;
39 | fi
40 |
41 | ./.luarocks/bin/luarocks install lbase64 20120807-3
42 | RET=$?; if [ $RET -ne 0 ];
43 | then echo "Error. Exiting."; exit $RET;
44 | fi
45 |
46 | ./.luarocks/bin/luarocks install luafilesystem
47 | RET=$?; if [ $RET -ne 0 ];
48 | then echo "Error. Exiting."; exit $RET;
49 | fi
50 |
51 | ./.luarocks/bin/luarocks install lub
52 | RET=$?; if [ $RET -ne 0 ];
53 | then echo "Error. Exiting."; exit $RET;
54 | fi
55 |
56 | ./.luarocks/bin/luarocks install luaexpat
57 | RET=$?; if [ $RET -ne 0 ];
58 | then echo "Error. Exiting."; exit $RET;
59 | fi
60 |
61 | ./.luarocks/bin/luarocks install redis-lua
62 | RET=$?; if [ $RET -ne 0 ];
63 | then echo "Error. Exiting."; exit $RET;
64 | fi
65 |
66 | ./.luarocks/bin/luarocks install lua-cjson
67 | RET=$?; if [ $RET -ne 0 ];
68 | then echo "Error. Exiting."; exit $RET;
69 | fi
70 |
71 | ./.luarocks/bin/luarocks install fakeredis
72 | RET=$?; if [ $RET -ne 0 ];
73 | then echo "Error. Exiting."; exit $RET;
74 | fi
75 |
76 | ./.luarocks/bin/luarocks install xml
77 | RET=$?; if [ $RET -ne 0 ];
78 | then echo "Error. Exiting."; exit $RET;
79 | fi
80 |
81 | ./.luarocks/bin/luarocks install feedparser
82 | RET=$?; if [ $RET -ne 0 ];
83 | then echo "Error. Exiting."; exit $RET;
84 | fi
85 |
86 | ./.luarocks/bin/luarocks install serpent
87 | RET=$?; if [ $RET -ne 0 ];
88 | then echo "Error. Exiting."; exit $RET;
89 | fi
90 | }
91 |
92 | install() {
93 | git pull
94 | git submodule update --init --recursive
95 | patch -i "patches/disable-python-and-libjansson.patch" -p 0 --batch --forward
96 | RET=$?;
97 |
98 | cd tg
99 | if [ $RET -ne 0 ]; then
100 | autoconf -i
101 | fi
102 | ./configure && make
103 |
104 | RET=$?; if [ $RET -ne 0 ]; then
105 | echo "Error. Exiting."; exit $RET;
106 | fi
107 | cd ..
108 | install_luarocks
109 | install_rocks
110 |
111 | if [ -d /mnt/c/Windows ]; then
112 | echo "Patching bot.lua for Windows 10 support..."
113 | sed -i '5d' bot/bot.lua
114 | sed -i '5d' bot/bot.lua
115 | sed -i '5i\require("bot/utils")' bot/bot.lua
116 | sed -i '6i\require("bot/permissions")' bot/bot.lua
117 | sed -i '7i\--File patched to support W10' bot/bot.lua
118 | fi
119 |
120 | }
121 |
122 | if [ "$1" = "install" ]; then
123 | install
124 | elif [ "$1" = "update" ]; then
125 | update
126 | else
127 | if [ ! -f ./tg/telegram.h ]; then
128 | echo "tg not found"
129 | echo "Run $0 install"
130 | exit 1
131 | fi
132 |
133 | if [ ! -f ./tg/bin/telegram-cli ]; then
134 | echo "tg binary not found"
135 | echo "Run $0 install"
136 | exit 1
137 | fi
138 |
139 | chmod 777 steady.sh
140 | chmod 777 start.sh
141 | chmod 777 config_fix.sh
142 |
143 | #Adding some color. By @iicc1 :D
144 | echo -e "\033[38;5;208m"
145 | echo -e " ____ ____ _____ "
146 | echo -e " | \| _ )_ _|___ ____ __ __ "
147 | echo -e " | |_ ) _ \ | |/ .__| _ \_| \/ | "
148 | echo -e " |____/|____/ |_|\____/\_____|_/\/\_| "
149 | echo -e " \033[0;00m"
150 | echo -e "\e[36m"
151 |
152 | if [ -f data/config.lua ]; then
153 | ./config_fix.sh
154 | fi
155 |
156 | if [ -f plugins/gban_installer.lua ]; then
157 |
158 | L=$(wc -l plugins/gban_installer.lua | cut -d " " -f1)
159 | R=$(echo $L -20 | bc)
160 |
161 | #N=$(grep -nr "send_msg('chat#id'.*" plugins/gban_installer.lua | cut -d ":" -f1)
162 | #M=$(grep -nr "send_msg('channel#id'.*" plugins/gban_installer.lua | cut -d ":" -f1)
163 |
164 | grep -v "send_msg('chat#id'.*" plugins/gban_installer.lua > gban1
165 | grep -v "send_msg('channel#id'.*" gban1 > plugins/gban_installer.lua
166 | sed -i "s/.*chat.*/&\n send_msg('chat#id'..msg.to.id, '$R accounts globally banned. ☠', ok_cb, false)/" plugins/gban_installer.lua
167 | sed -i "s/.*channel.*/&\n send_msg('channel#id'..msg.to.id, '$R accounts globally banned. ☠', ok_cb, false)/" plugins/gban_installer.lua
168 | rm gban1
169 |
170 | fi
171 |
172 | ./tg/bin/telegram-cli -k ./tg/tg-server.pub -s ./bot/bot.lua -l 1 -E $@
173 | fi
174 |
--------------------------------------------------------------------------------
/libs/mimetype.lua:
--------------------------------------------------------------------------------
1 | -- Thanks to https://github.com/catwell/lua-toolbox/blob/master/mime.types
2 | do
3 |
4 | local mimetype = {}
5 |
6 | -- TODO: Add more?
7 | local types = {
8 | ["text/html"] = "html",
9 | ["text/css"] = "css",
10 | ["text/xml"] = "xml",
11 | ["image/gif"] = "gif",
12 | ["image/jpeg"] = "jpg",
13 | ["application/x-javascript"] = "js",
14 | ["application/atom+xml"] = "atom",
15 | ["application/rss+xml"] = "rss",
16 | ["text/mathml"] = "mml",
17 | ["text/plain"] = "txt",
18 | ["text/vnd.sun.j2me.app-descriptor"] = "jad",
19 | ["text/vnd.wap.wml"] = "wml",
20 | ["text/x-component"] = "htc",
21 | ["image/png"] = "png",
22 | ["image/tiff"] = "tiff",
23 | ["image/vnd.wap.wbmp"] = "wbmp",
24 | ["image/x-icon"] = "ico",
25 | ["image/x-jng"] = "jng",
26 | ["image/x-ms-bmp"] = "bmp",
27 | ["image/svg+xml"] = "svg",
28 | ["image/webp"] = "webp",
29 | ["application/java-archive"] = "jar",
30 | ["application/mac-binhex40"] = "hqx",
31 | ["application/msword"] = "doc",
32 | ["application/pdf"] = "pdf",
33 | ["application/postscript"] = "ps",
34 | ["application/rtf"] = "rtf",
35 | ["application/vnd.ms-excel"] = "xls",
36 | ["application/vnd.ms-powerpoint"] = "ppt",
37 | ["application/vnd.wap.wmlc"] = "wmlc",
38 | ["application/vnd.google-earth.kml+xml"] = "kml",
39 | ["application/vnd.google-earth.kmz"] = "kmz",
40 | ["application/x-7z-compressed"] = "7z",
41 | ["application/x-cocoa"] = "cco",
42 | ["application/x-java-archive-diff"] = "jardiff",
43 | ["application/x-java-jnlp-file"] = "jnlp",
44 | ["application/x-makeself"] = "run",
45 | ["application/x-perl"] = "pl",
46 | ["application/x-pilot"] = "prc",
47 | ["application/x-rar-compressed"] = "rar",
48 | ["application/x-redhat-package-manager"] = "rpm",
49 | ["application/x-sea"] = "sea",
50 | ["application/x-shockwave-flash"] = "swf",
51 | ["application/x-stuffit"] = "sit",
52 | ["application/x-tcl"] = "tcl",
53 | ["application/x-x509-ca-cert"] = "crt",
54 | ["application/x-xpinstall"] = "xpi",
55 | ["application/xhtml+xml"] = "xhtml",
56 | ["application/zip"] = "zip",
57 | ["application/octet-stream"] = "bin",
58 | ["audio/midi"] = "mid",
59 | ["audio/mpeg"] = "mp3",
60 | ["audio/ogg"] = "ogg",
61 | ["audio/x-m4a"] = "m4a",
62 | ["audio/x-realaudio"] = "ra",
63 | ["video/3gpp"] = "3gpp",
64 | ["video/mp4"] = "mp4",
65 | ["video/mpeg"] = "mpeg",
66 | ["video/quicktime"] = "mov",
67 | ["video/webm"] = "webm",
68 | ["video/x-flv"] = "flv",
69 | ["video/x-m4v"] = "m4v",
70 | ["video/x-mng"] = "mng",
71 | ["video/x-ms-asf"] = "asf",
72 | ["video/x-ms-wmv"] = "wmv",
73 | ["video/x-msvideo"] = "avi"
74 | }
75 |
76 | -- Returns the common file extension from a content-type
77 | function mimetype.get_mime_extension(content_type)
78 | return types[content_type]
79 | end
80 |
81 | -- Returns the mimetype and subtype
82 | function mimetype.get_content_type(extension)
83 | for k,v in pairs(types) do
84 | if v == extension then
85 | return k
86 | end
87 | end
88 | end
89 |
90 | -- Returns the mimetype without the subtype
91 | function mimetype.get_content_type_no_sub(extension)
92 | for k,v in pairs(types) do
93 | if v == extension then
94 | -- Before /
95 | return k:match('([%w-]+)/')
96 | end
97 | end
98 | end
99 |
100 | return mimetype
101 | end
--------------------------------------------------------------------------------
/libs/redis.lua:
--------------------------------------------------------------------------------
1 | local Redis = require 'redis'
2 | local FakeRedis = require 'fakeredis'
3 |
4 | local params = {
5 | host = os.getenv('REDIS_HOST') or '127.0.0.1',
6 | port = tonumber(os.getenv('REDIS_PORT') or 6379)
7 | }
8 |
9 | local database = os.getenv('REDIS_DB')
10 | local password = os.getenv('REDIS_PASSWORD')
11 |
12 | -- Overwrite HGETALL
13 | Redis.commands.hgetall = Redis.command('hgetall', {
14 | response = function(reply, command, ...)
15 | local new_reply = { }
16 | for i = 1, #reply, 2 do new_reply[reply[i]] = reply[i + 1] end
17 | return new_reply
18 | end
19 | })
20 |
21 | local redis = nil
22 |
23 | -- Won't launch an error if fails
24 | local ok = pcall(function()
25 | redis = Redis.connect(params)
26 | end)
27 |
28 | if not ok then
29 |
30 | local fake_func = function()
31 | print('\27[31mCan\'t connect with Redis, install/configure it!\27[39m')
32 | end
33 | fake_func()
34 | fake = FakeRedis.new()
35 |
36 | print('\27[31mRedis addr: '..params.host..'\27[39m')
37 | print('\27[31mRedis port: '..params.port..'\27[39m')
38 |
39 | redis = setmetatable({fakeredis=true}, {
40 | __index = function(a, b)
41 | if b ~= 'data' and fake[b] then
42 | fake_func(b)
43 | end
44 | return fake[b] or fake_func
45 | end })
46 |
47 | else
48 | if password then
49 | redis:auth(password)
50 | end
51 | if database then
52 | redis:select(database)
53 | end
54 | end
55 |
56 |
57 | return redis
58 |
--------------------------------------------------------------------------------
/patches/disable-python-and-libjansson.patch:
--------------------------------------------------------------------------------
1 | --- tg/configure.ac 2015-10-24 14:23:51.964259062 +0200
2 | +++ tg/configure.ac 2015-10-24 14:05:10.111062758 +0200
3 | @@ -61,93 +61,43 @@
4 | ],[
5 | ])
6 |
7 | +# liblua is required
8 | AC_MSG_CHECKING([for liblua])
9 | -AC_ARG_ENABLE(liblua,[--enable-liblua/--disable-liblua],
10 | - [
11 | - if test "x$enableval" = "xno" ; then
12 | - AC_MSG_RESULT([disabled])
13 | - else
14 | - AC_MSG_RESULT([enabled])
15 | - AX_PROG_LUA([],[],
16 | - [
17 | - AX_LUA_HEADERS([],[AC_MSG_ERROR([No lua headers found. Try --disable-liblua])])
18 | - AX_LUA_LIBS([],[AC_MSG_ERROR([No lua libs found. Try --disable-liblua])])
19 | - [EXTRA_LIBS="${EXTRA_LIBS} ${LUA_LIB}" ; ]
20 | - [CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}" ; ]
21 | - AC_DEFINE(USE_LUA,1,[use lua])
22 | - ],
23 | - [
24 | - AC_MSG_ERROR([No lua found. Try --disable-liblua])
25 | - ])
26 | - fi
27 | - ],[
28 | - AC_MSG_RESULT([enabled])
29 | - AX_PROG_LUA([],[],
30 | - [
31 | - AX_LUA_HEADERS([],[AC_MSG_ERROR([No lua headers found. Try --disable-liblua])])
32 | - AX_LUA_LIBS([],[AC_MSG_ERROR([No lua libs found. Try --disable-liblua])])
33 | - [EXTRA_LIBS="${EXTRA_LIBS} ${LUA_LIB}" ; ]
34 | - [CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}" ; ]
35 | - AC_DEFINE(USE_LUA,1,[use lua])
36 | - ],
37 | - [
38 | - AC_MSG_ERROR([No lua found. Try --disable-liblua])
39 | - ])
40 | - ])
41 | -
42 | -AC_MSG_CHECKING([for python])
43 | -AC_ARG_ENABLE(python,[--enable-python/--disable-python],
44 | +AC_MSG_RESULT([enabled])
45 | +AX_PROG_LUA([],[],
46 | [
47 | - if test "x$enableval" = "xno" ; then
48 | - AC_MSG_RESULT([disabled])
49 | - else
50 | - AC_MSG_RESULT([enabled])
51 | -
52 | - AX_PYTHON()
53 | - AC_SUBST([PYTHON_FOUND])
54 | - if test $PYTHON_FOUND = no ; then
55 | - AC_MSG_ERROR([No supported python lib version found. Try --disable-python])
56 | - else
57 | - AC_SUBST([PYTHON_LIBS])
58 | - AC_SUBST([PYTHON_CFLAGS])
59 | - EXTRA_LIBS="${EXTRA_LIBS} -l${PYTHON_LIB}"
60 | - CPPFLAGS="${CPPFLAGS} -I${PYTHON_INCLUDE_DIR}"
61 | - AC_DEFINE(USE_PYTHON,1,[use python])
62 | - fi
63 | - fi
64 | - ],[
65 | - AC_MSG_RESULT([enabled])
66 | -
67 | - AX_PYTHON()
68 | - AC_SUBST([PYTHON_FOUND])
69 | - if test $PYTHON_FOUND = no ; then
70 | - AC_MSG_ERROR([No supported python lib version found. Try --disable-python])
71 | - else
72 | - AC_SUBST([PYTHON_LIBS])
73 | - AC_SUBST([PYTHON_CFLAGS])
74 | - EXTRA_LIBS="${EXTRA_LIBS} -l${PYTHON_LIB}"
75 | - CPPFLAGS="${CPPFLAGS} -I${PYTHON_INCLUDE_DIR}"
76 | - AC_DEFINE(USE_PYTHON,1,[use python])
77 | - fi
78 | + AX_LUA_HEADERS([],[AC_MSG_ERROR([No lua headers found. Install them])])
79 | + AX_LUA_LIBS([],[AC_MSG_ERROR([No lua libs found. Install them])])
80 | + [EXTRA_LIBS="${EXTRA_LIBS} ${LUA_LIB}" ; ]
81 | + [CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}" ; ]
82 | + AC_DEFINE(USE_LUA,1,[use lua])
83 | + ],
84 | + [
85 | + AC_MSG_ERROR([No lua found. Install lua])
86 | ])
87 |
88 | +# Optional
89 | +AC_MSG_CHECKING([for python])
90 | +AX_PYTHON()
91 | +AC_SUBST([PYTHON_FOUND])
92 | +if test $PYTHON_FOUND = no ; then
93 | + AC_MSG_RESULT([disabled])
94 | +else
95 | + AC_SUBST([PYTHON_LIBS])
96 | + AC_SUBST([PYTHON_CFLAGS])
97 | + EXTRA_LIBS="${EXTRA_LIBS} -l${PYTHON_LIB}"
98 | + CPPFLAGS="${CPPFLAGS} -I${PYTHON_INCLUDE_DIR}"
99 | + AC_DEFINE(USE_PYTHON,1,[use python])
100 | +fi
101 |
102 | -
103 | +# Optional
104 | AC_MSG_CHECKING([for libjansson])
105 | -AC_ARG_ENABLE(json,[--enable-json/--disable-json],
106 | - [
107 | - if test "x$enableval" = "xno" ; then
108 | - AC_MSG_RESULT([disabled])
109 | - else
110 | - AC_MSG_RESULT([enabled])
111 | - AC_CHECK_LIB([jansson],[json_array_set_new],[],AC_MSG_ERROR([No libjansson found. Try --disable-json]))
112 | - AC_DEFINE(USE_JSON,1,[use json])
113 | - fi
114 | - ],[
115 | +AC_CHECK_LIB([jansson],[json_array_set_new],
116 | + [
117 | AC_MSG_RESULT([enabled])
118 | - AC_CHECK_LIB([jansson],[json_array_set_new],[],AC_MSG_ERROR([No libjansson found. Try --disable-json]))
119 | AC_DEFINE(USE_JSON,1,[use json])
120 | - ])
121 | + ],
122 | + [AC_MSG_RESULT([disabled])])
123 |
124 | #check for custom prog name
125 | AC_MSG_CHECKING([progname])
126 | @@ -193,4 +143,3 @@
127 | AC_SUBST(EXTRA_LIBS)
128 | AC_CONFIG_FILES([Makefile])
129 | AC_OUTPUT
130 | -
131 |
--------------------------------------------------------------------------------
/plugins/arabic.lua:
--------------------------------------------------------------------------------
1 | local function run(msg)
2 | local hash = 'arabic:'..msg.to.id
3 | if redis:get(hash) then
4 | delete_msg(msg.id, ok_cb, false)
5 | if msg.to.type == 'chat' then
6 | send_msg('chat#id'..msg.to.id, lang_text(msg.to.id, 'noArabicT'), ok_cb, true)
7 | chat_del_user('chat#id'..msg.to.id, 'user#id'..msg.from.id, ok_cb, true)
8 | elseif msg.to.type == 'channel' then
9 | send_msg('channel#id'..msg.to.id, lang_text(msg.to.id, 'noArabicL'), ok_cb, true)
10 | channel_kick_user('channel#id'..msg.to.id, 'user#id'..msg.from.id, ok_cb, true)
11 | end
12 | return
13 | end
14 | end
15 |
16 | return {
17 | patterns = {
18 | '([\216-\219][\128-\191])'
19 | },
20 | run = run
21 | }
--------------------------------------------------------------------------------
/plugins/bot.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------
2 | -- ____ ____ _____ --
3 | -- | \| _ )_ _|___ ____ __ __ --
4 | -- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
5 | -- |____/|____/ |_|\____/\_____|_/\/\_| --
6 | -- --
7 | --------------------------------------------------
8 | -- --
9 | -- Developers: @Josepdal & @MaSkAoS --
10 | -- Support: @Skneos, @iicc1 & @serx666 --
11 | -- @h3iran :D --
12 | --------------------------------------------------
13 | local function is_channel_disabled( receiver )
14 | if not _config.disabled_channels then
15 | return false
16 | end
17 |
18 | if _config.disabled_channels[receiver] == nil then
19 | return false
20 | end
21 |
22 | return _config.disabled_channels[receiver]
23 | end
24 |
25 | local function enable_channel(receiver, to_id)
26 | if not _config.disabled_channels then
27 | _config.disabled_channels = {}
28 | end
29 |
30 | if _config.disabled_channels[receiver] == nil then
31 | return lang_text(to_id, 'botOn')..' 😏'
32 | end
33 |
34 | _config.disabled_channels[receiver] = false
35 |
36 | save_config()
37 | return lang_text(to_id, 'botOn')..' 😏'
38 | end
39 |
40 | local function disable_channel(receiver, to_id)
41 | if not _config.disabled_channels then
42 | _config.disabled_channels = {}
43 | end
44 |
45 | _config.disabled_channels[receiver] = true
46 |
47 | save_config()
48 | return lang_text(to_id, 'botOff')..' 🚀'
49 | end
50 |
51 | local function pre_process(msg)
52 | local receiver = get_receiver(msg)
53 |
54 | -- If sender is sudo then re-enable the channel
55 | if is_sudo(msg) then
56 | if msg.text == "#bot on" or msg.text == "!bot on" or msg.text == "/bot on" then
57 | enable_channel(receiver, msg.to.id)
58 | end
59 | end
60 |
61 | if is_channel_disabled(receiver) then
62 | msg.text = ""
63 | end
64 |
65 | return msg
66 | end
67 |
68 | local function run(msg, matches)
69 | if permissions(msg.from.id, msg.to.id, "bot") then
70 | local receiver = get_receiver(msg)
71 | -- Enable a channel
72 | if matches[1] == 'on' then
73 | return enable_channel(receiver, msg.to.id)
74 | end
75 | -- Disable a channel
76 | if matches[1] == 'off' then
77 | return disable_channel(receiver, msg.to.id)
78 | end
79 | else
80 | return '🚫 '..lang_text(msg.to.id, 'require_sudo')
81 | end
82 | end
83 |
84 | return {
85 | patterns = {
86 | "^[!/#]bot? (on)",
87 | "^[!/#]bot? (off)" },
88 | run = run,
89 | pre_process = pre_process
90 | }
91 |
--------------------------------------------------------------------------------
/plugins/commands.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------
2 | -- ____ ____ _____ --
3 | -- | \| _ )_ _|___ ____ __ __ --
4 | -- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
5 | -- |____/|____/ |_|\____/\_____|_/\/\_| --
6 | -- --
7 | --------------------------------------------------
8 | -- --
9 | -- Developers: @Josepdal & @MaSkAoS --
10 | -- Support: @Skneos, @iicc1 & @serx666 --
11 | -- --
12 | --------------------------------------------------
13 |
14 | do
15 | local function run(msg, matches)
16 | text = '#⃣ '..lang_text(msg.to.id, 'commandsT')..':\n'
17 | local space = '\n'
18 | if matches[1] == 'commands' and not matches[2] then
19 | if permissions(msg.from.id, msg.to.id, "mod_commands") then
20 | local langHash = 'langset:'..msg.to.id
21 | local lang = redis:get(langHash)
22 | for v,plugin in pairs(_config.enabled_plugins) do
23 | local textHash = 'lang:'..lang..':'..plugin..':0'
24 | if redis:get(textHash) then
25 | for i=1, tonumber(lang_text(msg.to.id, plugin..':0')), 1 do
26 | text = text..lang_text(msg.to.id, plugin..':'..i)..'\n'
27 | end
28 | text = text..space
29 | end
30 | end
31 | else
32 | text = text..lang_text(msg.to.id, 'moderation:5')..'\n'
33 | text = text..lang_text(msg.to.id, 'version:1')..'\n'
34 | text = text..lang_text(msg.to.id, 'rules:1')..'\n'
35 | end
36 | elseif matches[1] == 'commands' and matches[2] then
37 | if permissions(msg.from.id, msg.to.id, "mod_commands") then
38 | local langHash = 'langset:'..msg.to.id
39 | local lang = redis:get(langHash)
40 | for v,plugin in pairs(_config.enabled_plugins) do
41 | if plugin == matches[2] then
42 | local textHash = 'lang:'..lang..':'..plugin..':0'
43 | if redis:get(textHash) then
44 | for i=1, tonumber(lang_text(msg.to.id, plugin..':0')), 1 do
45 | text = text..lang_text(msg.to.id, plugin..':'..i)..'\n'
46 | end
47 | end
48 | return text
49 | end
50 | end
51 | return 'ℹ️ '..lang_text(msg.to.id, 'errorNoPlug')
52 | else
53 | return '🚫 '..lang_text(msg.to.id, 'require_mod')
54 | end
55 | end
56 | return text
57 | end
58 |
59 | return {
60 | patterns = {
61 | "^[!/#](commands)$",
62 | "^[!/#](commands) (.+)"
63 | },
64 | run = run
65 | }
66 | end
67 |
68 | for v,user in pairs(_gbans.gbans_users) do
69 | if tonumber(user) == tonumber(user_id) then
70 | return true
71 | end
72 | end
73 |
--------------------------------------------------------------------------------
/plugins/export_gban.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------
2 | -- ____ ____ _____ --
3 | -- | \| _ )_ _|___ ____ __ __ --
4 | -- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
5 | -- |____/|____/ |_|\____/\_____|_/\/\_| --
6 | -- --
7 | --------------------------------------------------
8 | -- --
9 | -- Developers: @Josepdal & @MaSkAoS --
10 | -- Support: @Skneos, @iicc1 & @serx666 --
11 | -- --
12 | --------------------------------------------------
13 |
14 | local function run(msg, matches)
15 | if permissions(msg.from.id, msg.to.id, "export_gban") then
16 | if matches[1] == 'gbans' then
17 | local receiver = get_receiver(msg)
18 | if matches[2] == 'installer' then
19 | local text = 'local function run(msg)\nif permissions(msg.from.id, msg.to.id, "gban_installer") then\n'
20 | local count = 0
21 | for v,user in pairs(_gbans.gbans_users) do
22 | text = text..'gban_id('..user..')\n'
23 | count = count + 1
24 | end
25 |
26 | local text = text..[[
27 | if msg.to.type == 'chat' then
28 | send_msg('chat#id'..msg.to.id, ']]..count..' '..lang_text(msg.to.id, 'accountsGban')..[[ ☠', ok_cb, false)
29 | elseif msg.to.type == 'channel' then
30 | send_msg('channel#id'..msg.to.id, ']]..count..' '..lang_text(msg.to.id, 'accountsGban')..[[ ☠', ok_cb, false)
31 | end
32 | else
33 | return '🚫 '..lang_text(msg.to.id, 'require_sudo')
34 | end
35 | end
36 |
37 | return {
38 | description = 'Add gbans into your bot. A gbanlist command.',
39 | usage = {},
40 | patterns = {
41 | "^#(install) (gbans)$"
42 | },
43 | run = run
44 | }
45 | ]]
46 |
47 | local file = io.open("./plugins/gban_installer.lua", "w")
48 | file:write(text)
49 | file:close()
50 |
51 | send_document(receiver, './plugins/gban_installer.lua', ok_cb, false)
52 | elseif matches[2] == 'list' then
53 | send_document(receiver, './data/gbans.lua', ok_cb, false)
54 | end
55 | end
56 | else
57 | return '🚫 '..lang_text(msg.to.id, 'require_admin')
58 | end
59 | end
60 |
61 | return {
62 | patterns = {
63 | "^#(gbans) (.*)$"
64 | },
65 | run = run
66 | }
67 |
--------------------------------------------------------------------------------
/plugins/giverank.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------
2 | -- ____ ____ _____ --
3 | -- | \| _ )_ _|___ ____ __ __ --
4 | -- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
5 | -- |____/|____/ |_|\____/\_____|_/\/\_| --
6 | -- --
7 | --------------------------------------------------
8 | -- --
9 | -- Developers: @Josepdal & @MaSkAoS --
10 | -- Support: @Skneos, @iicc1 & @serx666 --
11 | -- --
12 | --------------------------------------------------
13 |
14 | local function index_function(user_id)
15 | for k,v in pairs(_config.admin_users) do
16 | if user_id == v[1] then
17 | print(k)
18 | return k
19 | end
20 | end
21 | -- If not found
22 | return false
23 | end
24 |
25 | local function admin_by_username(cb_extra, success, result)
26 | local chat_type = cb_extra.chat_type
27 | local chat_id = cb_extra.chat_id
28 | local user_id = result.peer_id
29 | local user_name = result.username
30 | if is_admin(user_id) then
31 | if chat_type == 'chat' then
32 | send_msg('chat#id'..chat_id, 'ℹ️ '..lang_text(chat_id, 'alreadyAdmin'), ok_cb, false)
33 | elseif chat_type == 'channel' then
34 | send_msg('channel#id'..chat_id, 'ℹ️ '..lang_text(chat_id, 'alreadyAdmin'), ok_cb, false)
35 | end
36 | else
37 | table.insert(_config.admin_users, {tonumber(user_id), user_name})
38 | print(user_id..' added to _config table')
39 | save_config()
40 | if chat_type == 'chat' then
41 | send_msg('chat#id'..chat_id, '🆕 '..lang_text(chat_id, 'newAdmin')..' @'..user_name..' ('..user_id..')', ok_cb, false)
42 | elseif chat_type == 'channel' then
43 | send_msg('channel#id'..chat_id, '🆕 '..lang_text(chat_id, 'newAdmin')..' @'..user_name..' ('..user_id..')', ok_cb, false)
44 | end
45 | end
46 | end
47 |
48 | local function mod_by_username(cb_extra, success, result)
49 | local chat_type = cb_extra.chat_type
50 | local chat_id = cb_extra.chat_id
51 | local user_id = result.peer_id
52 | local user_name = result.username
53 | local hash = 'mod:'..chat_id..':'..user_id
54 | if redis:get(hash) then
55 | if chat_type == 'chat' then
56 | send_msg('chat#id'..chat_id, 'ℹ️ '..lang_text(chat_id, 'alreadyMod'), ok_cb, false)
57 | elseif chat_type == 'channel' then
58 | send_msg('channel#id'..chat_id, 'ℹ️ '..lang_text(chat_id, 'alreadyMod'), ok_cb, false)
59 | end
60 | else
61 | redis:set(hash, true)
62 | if chat_type == 'chat' then
63 | send_msg('chat#id'..chat_id, '🆕 '..lang_text(chat_id, 'newMod')..' @'..user_name..' ('..user_id..')', ok_cb, false)
64 | elseif chat_type == 'channel' then
65 | send_msg('channel#id'..chat_id, '🆕 '..lang_text(chat_id, 'newMod')..' @'..user_name..' ('..user_id..')', ok_cb, false)
66 | end
67 | end
68 | end
69 |
70 | local function guest_by_username(cb_extra, success, result)
71 | local chat_type = cb_extra.chat_type
72 | local chat_id = cb_extra.chat_id
73 | local user_id = result.peer_id
74 | local user_name = result.username
75 | local nameid = index_function(user_id)
76 | local hash = 'mod:'..chat_id..':'..user_id
77 | if redis:get(hash) then
78 | redis:del(hash)
79 | end
80 | if is_admin(user_id) then
81 | table.remove(_config.admin_users, nameid)
82 | print(user_id..' added to _config table')
83 | save_config()
84 | end
85 | if chat_type == 'chat' then
86 | send_msg('chat#id'..chat_id, 'ℹ️ @'..user_name..' ('..user_id..') '..lang_text(chat_id, 'nowUser'), ok_cb, false)
87 | elseif chat_type == 'channel' then
88 | send_msg('channel#id'..chat_id, 'ℹ️ @'..user_name..' ('..user_id..') '..lang_text(chat_id, 'nowUser'), ok_cb, false)
89 | end
90 | end
91 |
92 | local function set_admin(cb_extra, success, result)
93 | local chat_id = cb_extra.chat_id
94 | local user_id = cb_extra.user_id
95 | local user_name = result.username
96 | local chat_type = cb_extra.chat_type
97 | if is_admin(tonumber(user_id)) then
98 | if chat_type == 'chat' then
99 | send_msg('chat#id'..chat_id, 'ℹ️ '..lang_text(chat_id, 'alreadyAdmin'), ok_cb, false)
100 | elseif chat_type == 'channel' then
101 | send_msg('channel#id'..chat_id, 'ℹ️ '..lang_text(chat_id, 'alreadyAdmin'), ok_cb, false)
102 | end
103 | else
104 | table.insert(_config.admin_users, {tonumber(user_id), user_name})
105 | print(user_id..' added to _config table')
106 | save_config()
107 | if cb_extra.chat_type == 'chat' then
108 | send_msg('chat#id'..chat_id, '🆕 '..lang_text(chat_id, 'newAdmin')..' @'..user_name..' ('..user_id..')', ok_cb, false)
109 | elseif cb_extra.chat_type == 'channel' then
110 | send_msg('channel#id'..chat_id, '🆕 '..lang_text(chat_id, 'newAdmin')..' @'..user_name..' ('..user_id..')', ok_cb, false)
111 | end
112 | end
113 | end
114 |
115 | local function set_mod(cb_extra, success, result)
116 | local chat_id = cb_extra.chat_id
117 | local user_id = cb_extra.user_id
118 | local user_name = result.username
119 | local chat_type = cb_extra.chat_type
120 | local hash = 'mod:'..chat_id..':'..user_id
121 | if redis:get(hash) then
122 | if chat_type == 'chat' then
123 | send_msg('chat#id'..chat_id, 'ℹ️ '..lang_text(chat_id, 'alreadyMod'), ok_cb, false)
124 | elseif chat_type == 'channel' then
125 | send_msg('channel#id'..chat_id, 'ℹ️ '..lang_text(chat_id, 'alreadyMod'), ok_cb, false)
126 | end
127 | else
128 | redis:set(hash, true)
129 | if cb_extra.chat_type == 'chat' then
130 | send_msg('chat#id'..chat_id, '🆕 '..lang_text(chat_id, 'newMod')..' @'..user_name..' ('..user_id..')', ok_cb, false)
131 | elseif cb_extra.chat_type == 'channel' then
132 | send_msg('channel#id'..chat_id, '🆕 '..lang_text(chat_id, 'newMod')..' @'..user_name..' ('..user_id..')', ok_cb, false)
133 | end
134 | end
135 | end
136 |
137 | local function set_guest(cb_extra, success, result)
138 | local chat_id = cb_extra.chat_id
139 | local user_id = cb_extra.user_id
140 | local user_name = result.username
141 | local chat_type = cb_extra.chat_type
142 | local nameid = index_function(tonumber(user_id))
143 | local hash = 'mod:'..chat_id..':'..user_id
144 | if redis:get(hash) then
145 | redis:del(hash)
146 | end
147 | if is_admin(user_id) then
148 | table.remove(_config.admin_users, nameid)
149 | print(user_id..' added to _config table')
150 | save_config()
151 | end
152 | if cb_extra.chat_type == 'chat' then
153 | send_msg('chat#id'..chat_id, 'ℹ️ @'..user_name..' ('..user_id..') '..lang_text(chat_id, 'nowUser'), ok_cb, false)
154 | elseif cb_extra.chat_type == 'channel' then
155 | send_msg('channel#id'..chat_id, 'ℹ️ @'..user_name..' ('..user_id..') '..lang_text(chat_id, 'nowUser'), ok_cb, false)
156 | end
157 | end
158 |
159 | local function admin_by_reply(extra, success, result)
160 | local result = backward_msg_format(result)
161 | local msg = result
162 | local chat_id = msg.to.id
163 | local user_id = msg.from.id
164 | local chat_type = msg.to.type
165 | user_info('user#id'..user_id, set_admin, {chat_type=chat_type, chat_id=chat_id, user_id=user_id})
166 | end
167 |
168 | local function mod_by_reply(extra, success, result)
169 | local result = backward_msg_format(result)
170 | local msg = result
171 | local chat_id = msg.to.id
172 | local user_id = msg.from.id
173 | local chat_type = msg.to.type
174 | user_info('user#id'..user_id, set_mod, {chat_type=chat_type, chat_id=chat_id, user_id=user_id})
175 | end
176 |
177 | local function guest_by_reply(extra, success, result)
178 | local result = backward_msg_format(result)
179 | local msg = result
180 | local chat_id = msg.to.id
181 | local user_id = msg.from.id
182 | local chat_type = msg.to.type
183 | user_info('user#id'..user_id, set_guest, {chat_type=chat_type, chat_id=chat_id, user_id=user_id})
184 | end
185 |
186 | local function members_chat(cb_extra, success, result)
187 | local chat_id = cb_extra.chat_id
188 | local text = ""
189 | for k,v in pairs(result.members) do
190 | if v.username then
191 | text = text..'@'..v.username..' '
192 | end
193 | end
194 | return send_large_msg('chat#id'..chat_id, text, ok_cb, true)
195 | end
196 |
197 | local function members_channel(extra, success, result)
198 | local chat_id = extra.chat_id
199 | local text = ""
200 | for k,user in ipairs(result) do
201 | if user.username then
202 | text = text..'@'..user.username..' '
203 | end
204 | end
205 | return send_large_msg('channel#id'..chat_id, text, ok_cb, true)
206 | end
207 |
208 | local function members_chat_msg(cb_extra, success, result)
209 | local chat_id = cb_extra.chat_id
210 | local text = ' '
211 | for k,v in pairs(result.members) do
212 | if v.username then
213 | text = text..'@'..v.username..' '
214 | end
215 | end
216 | text = text..'\n\n'..extra.text_msg
217 | return send_large_msg('chat#id'..chat_id, text, ok_cb, true)
218 | end
219 |
220 | local function members_channel_msg(extra, success, result)
221 | local chat_id = extra.chat_id
222 | local text = ' '
223 | for k,user in ipairs(result) do
224 | if user.username then
225 | text = text..'@'..user.username..' '
226 | end
227 | end
228 | text = text..'\n\n'..extra.text_msg
229 | return send_large_msg('channel#id'..chat_id, text, ok_cb, true)
230 | end
231 |
232 | local function mods_channel(extra, success, result)
233 | local chat_id = extra.chat_id
234 | local text = '🔆 '..lang_text(chat_id, 'modList')..':\n'
235 | local compare = text
236 | for k,user in ipairs(result) do
237 | hash = 'mod:'..chat_id..':'..user.peer_id
238 | if redis:get(hash) then
239 | text = text..'🔅 '..user.username..'\n'
240 | end
241 | end
242 | if text == compare then
243 | text = text..'🔅 '..lang_text(chat_id, 'modEmpty')
244 | end
245 | return send_large_msg('channel#id'..chat_id, text, ok_cb, true)
246 | end
247 |
248 | local function mods_chat(extra, success, result)
249 | local chat_id = extra.chat_id
250 | local text = '🔆 '..lang_text(chat_id, 'modList')..':\n'
251 | local compare = text
252 | for k,user in ipairs(result.members) do
253 | if user.username then
254 | hash = 'mod:'..chat_id..':'..user.peer_id
255 | if redis:get(hash) then
256 | text = text..'🔅 '..user.username..'\n'
257 | end
258 | end
259 | end
260 | if text == compare then
261 | text = text..'🔅 '..lang_text(chat_id, 'modEmpty')
262 | end
263 | return send_large_msg('chat#id'..chat_id, text, ok_cb, true)
264 | end
265 |
266 | local function run(msg, matches)
267 | user_id = msg.from.id
268 | chat_id = msg.to.id
269 | if matches[1] == 'rank' then
270 | if matches[2] == 'admin' then
271 | if permissions(user_id, chat_id, "rank_admin") then
272 | if msg.reply_id then
273 | get_message(msg.reply_id, admin_by_reply, false)
274 | end
275 | if is_id(matches[3]) then
276 | chat_type = msg.to.type
277 | chat_id = msg.to.id
278 | user_id = matches[3]
279 | user_info('user#id'..user_id, set_admin, {chat_type=chat_type, chat_id=chat_id, user_id=user_id})
280 | else
281 | chat_type = msg.to.type
282 | chat_id = msg.to.id
283 | local member = string.gsub(matches[3], '@', '')
284 | resolve_username(member, admin_by_username, {chat_id=chat_id, member=member, chat_type=chat_type})
285 | end
286 | else
287 | return '🚫 '..lang_text(msg.to.id, 'require_sudo')
288 | end
289 | end
290 | if matches[2] == 'mod' then
291 | if permissions(user_id, chat_id, "rank_mod") then
292 | if msg.reply_id then
293 | get_message(msg.reply_id, mod_by_reply, false)
294 | end
295 | if is_id(matches[3]) then
296 | chat_type = msg.to.type
297 | chat_id = msg.to.id
298 | user_id = matches[3]
299 | user_info('user#id'..user_id, set_mod, {chat_type=chat_type, chat_id=chat_id, user_id=user_id})
300 | else
301 | chat_type = msg.to.type
302 | chat_id = msg.to.id
303 | local member = string.gsub(matches[3], '@', '')
304 | resolve_username(member, mod_by_username, {chat_id=chat_id, member=member, chat_type=chat_type})
305 | end
306 | else
307 | return '🚫 '..lang_text(msg.to.id, 'require_admin')
308 | end
309 | end
310 | if matches[2] == 'guest' then
311 | if permissions(user_id, chat_id, "rank_guest") then
312 | if msg.reply_id then
313 | get_message(msg.reply_id, guest_by_reply, false)
314 | end
315 | if is_id(matches[3]) then
316 | chat_type = msg.to.type
317 | chat_id = msg.to.id
318 | user_id = matches[3]
319 | user_info('user#id'..user_id, set_guest, {chat_type=chat_type, chat_id=chat_id, user_id=user_id})
320 | else
321 | chat_type = msg.to.type
322 | chat_id = msg.to.id
323 | local member = string.gsub(matches[3], '@', '')
324 | resolve_username(member, guest_by_username, {chat_id=chat_id, member=member, chat_type=chat_type})
325 | end
326 | else
327 | return '🚫 '..lang_text(msg.to.id, 'require_sudo')
328 | end
329 | end
330 | elseif matches[1] == 'admins' then
331 | if permissions(user_id, chat_id, "admins") then
332 | -- Check users id in config
333 | local text = '🔆 '..lang_text(msg.to.id, 'adminList')..':\n'
334 | local compare = text
335 | for v,user in pairs(_config.admin_users) do
336 | text = text..'🔅 '..user[2]..' ('..user[1]..')\n'
337 | end
338 | if compare == text then
339 | text = text..'🔅 '..lang_text(chat_id, 'adminEmpty')
340 | end
341 | return text
342 | else
343 | return '🚫 '..lang_text(msg.to.id, 'require_mod')
344 | end
345 | elseif matches[1] == 'members' then
346 | if permissions(user_id, chat_id, "members") then
347 | local chat_id = msg.to.id
348 | if matches[2] then
349 | if msg.to.type == 'chat' then
350 | local receiver = 'chat#id'..msg.to.id
351 | chat_info(receiver, members_chat_msg, {chat_id=chat_id, text_msg=matches[2]})
352 | else
353 | local chan = ("%s#id%s"):format(msg.to.type, msg.to.id)
354 | channel_get_users(chan, members_channel_msg, {chat_id=chat_id, text_msg=matches[2]})
355 | end
356 | delete_msg(msg.id, ok_cb, false)
357 | else
358 | if msg.to.type == 'chat' then
359 | local receiver = 'chat#id'..msg.to.id
360 | chat_info(receiver, members_chat, {chat_id=chat_id})
361 | else
362 | local chan = ("%s#id%s"):format(msg.to.type, msg.to.id)
363 | channel_get_users(chan, members_channel, {chat_id=chat_id})
364 | end
365 | end
366 | else
367 | return '🚫 '..lang_text(msg.to.id, 'require_mod')
368 | end
369 | elseif matches[1] == 'mods' then
370 | if permissions(user_id, chat_id, "mods") then
371 | local chat_id = msg.to.id
372 | if msg.to.type == 'chat' then
373 | local receiver = 'chat#id'..msg.to.id
374 | chat_info(receiver, mods_chat, {chat_id=chat_id})
375 | else
376 | local chan = ("%s#id%s"):format(msg.to.type, msg.to.id)
377 | channel_get_users(chan, mods_channel, {chat_id=chat_id})
378 | end
379 | else
380 | return '🚫 '..lang_text(msg.to.id, 'require_mod')
381 | end
382 | end
383 | end
384 |
385 |
386 |
387 | return {
388 | patterns = {
389 | "^[!/#](rank) (.*) (.*)$",
390 | "^[!/#](rank) (.*)$",
391 | "^[!/#](admins)$",
392 | "^[!/#](mods)$",
393 | "^[!/#](members)$",
394 | "^[!/#](members) (.*)$"
395 | },
396 | run = run
397 | }
398 |
--------------------------------------------------------------------------------
/plugins/id.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------
2 | -- ____ ____ _____ --
3 | -- | \| _ )_ _|___ ____ __ __ --
4 | -- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
5 | -- |____/|____/ |_|\____/\_____|_/\/\_| --
6 | -- --
7 | --------------------------------------------------
8 | -- --
9 | -- Developers: @Josepdal & @MaSkAoS --
10 | -- Support: @Skneos, @iicc1 & @serx666 --
11 | -- --
12 | --------------------------------------------------
13 |
14 | local function usernameinfo (user)
15 | if user.username then
16 | return '@'..user.username
17 | end
18 | if user.print_name then
19 | return user.print_name
20 | end
21 | local text = ''
22 | if user.first_name then
23 | text = user.last_name..' '
24 | end
25 | if user.lastname then
26 | text = text..user.last_name
27 | end
28 | return text
29 | end
30 |
31 | local function whoisname(cb_extra, success, result)
32 | chat_type = cb_extra.chat_type
33 | chat_id = cb_extra.chat_id
34 | user_id = result.peer_id
35 | user_username = result.username
36 | if chat_type == 'chat' then
37 | send_msg('chat#id'..chat_id, '👤 '..lang_text(chat_id, 'user')..' @'..user_username..' ('..user_id..')', ok_cb, false)
38 | elseif chat_type == 'channel' then
39 | send_msg('channel#id'..chat_id, '👤 '..lang_text(chat_id, 'user')..' @'..user_username..' ('..user_id..')', ok_cb, false)
40 | end
41 | end
42 |
43 | local function whoisid(cb_extra, success, result)
44 | chat_id = cb_extra.chat_id
45 | user_id = cb_extra.user_id
46 | if cb_extra.chat_type == 'chat' then
47 | send_msg('chat#id'..chat_id, '👤 '..lang_text(chat_id, 'user')..' @'..result.username..' ('..user_id..')', ok_cb, false)
48 | elseif cb_extra.chat_type == 'channel' then
49 | send_msg('channel#id'..chat_id, '👤 '..lang_text(chat_id, 'user')..' @'..result.username..' ('..user_id..')', ok_cb, false)
50 | end
51 | end
52 |
53 | local function channelUserIDs (extra, success, result)
54 | local receiver = extra.receiver
55 | print('Result')
56 | vardump(result)
57 | local text = ''
58 | for k,user in ipairs(result) do
59 | local id = user.peer_id
60 | local username = usernameinfo (user)
61 | text = text..("%s - %s\n"):format(username, id)
62 | end
63 | send_large_msg(receiver, text)
64 | end
65 |
66 | local function get_id_who(extra, success, result)
67 | result = backward_msg_format(result)
68 | local msg = result
69 | local chat = msg.to.id
70 | local user = msg.from.id
71 | if msg.to.type == 'chat' then
72 | send_msg('chat#id'..msg.to.id, '🆔 '..lang_text(chat, 'user')..' ID: '..msg.from.id, ok_cb, false)
73 | elseif msg.to.type == 'channel' then
74 | send_msg('channel#id'..msg.to.id, '🆔 '..lang_text(chat, 'user')..' ID: '..msg.from.id, ok_cb, false)
75 | end
76 | end
77 |
78 | local function returnids (extra, success, result)
79 | local receiver = extra.receiver
80 | local chatname = result.print_name
81 | local id = result.peer_id
82 | local text = ('ID for chat %s (%s):\n'):format(chatname, id)
83 | for k,user in ipairs(result.members) do
84 | local username = usernameinfo(user)
85 | local id = user.peer_id
86 | local userinfo = ("%s - %s\n"):format(username, id)
87 | text = text .. userinfo
88 | end
89 | send_large_msg(receiver, text)
90 | end
91 |
92 | local function run(msg, matches)
93 | local receiver = get_receiver(msg)
94 | local chat = msg.to.id
95 | -- Id of the user and info about group / channel
96 | if matches[1] == "id" then
97 | if permissions(msg.from.id, msg.to.id, "id") then
98 | if msg.to.type == 'channel' then
99 | send_msg(msg.to.peer_id, '🔠 '..lang_text(chat, 'supergroupName')..': '..msg.to.print_name:gsub("_", " ")..'\n👥 '..lang_text(chat, 'supergroup')..' ID: '..msg.to.id..'\n🆔 '..lang_text(chat, 'user')..' ID: '..msg.from.id, ok_cb, false)
100 | elseif msg.to.type == 'chat' then
101 | send_msg(msg.to.peer_id, '🔠 '..lang_text(chat, 'chatName')..': '..msg.to.print_name:gsub("_", " ")..'\n👥 '..lang_text(chat, 'chat')..' ID: '..msg.to.id..'\n🆔 '..lang_text(chat, 'user')..' ID: '..msg.from.id, ok_cb, false)
102 | end
103 | end
104 | elseif matches[1] == 'whois' then
105 | if permissions(msg.from.id, msg.to.id, "whois") then
106 | chat_type = msg.to.type
107 | chat_id = msg.to.id
108 | if msg.reply_id then
109 | get_message(msg.reply_id, get_id_who, {receiver=get_receiver(msg)})
110 | return
111 | end
112 | if is_id(matches[2]) then
113 | print(1)
114 | user_info('user#id'..matches[2], whoisid, {chat_type=chat_type, chat_id=chat_id, user_id=matches[2]})
115 | return
116 | else
117 | local member = string.gsub(matches[2], '@', '')
118 | resolve_username(member, whoisname, {chat_id=chat_id, member=member, chat_type=chat_type})
119 | return
120 | end
121 | else
122 | return '🚫 '..lang_text(msg.to.id, 'require_mod')
123 | end
124 | elseif matches[1] == 'chat' or matches[1] == 'channel' then
125 | if permissions(msg.from.id, msg.to.id, "whois") then
126 | local type = matches[1]
127 | local chanId = matches[2]
128 | -- !ids? (chat) (%d+)
129 | if chanId then
130 | local chan = ("%s#id%s"):format(type, chanId)
131 | if type == 'chat' then
132 | chat_info(chan, returnids, {receiver=receiver})
133 | else
134 | channel_get_users(chan, channelUserIDs, {receiver=receiver})
135 | end
136 | else
137 | -- !id chat/channel
138 | local chan = ("%s#id%s"):format(msg.to.type, msg.to.id)
139 | if msg.to.type == 'channel' then
140 | channel_get_users(chan, channelUserIDs, {receiver=receiver})
141 | end
142 | if msg.to.type == 'chat' then
143 | chat_info(chan, returnids, {receiver=receiver})
144 | end
145 | end
146 | else
147 | return '🚫 '..lang_text(msg.to.id, 'require_mod')
148 | end
149 | end
150 | end
151 |
152 | return {
153 | patterns = {
154 | "^[!/#](whois)$",
155 | "^[!/#](id)$",
156 | "^[!/#]ids? (chat)$",
157 | "^[!/#]ids? (channel)$",
158 | "^[!/#](whois) (.*)$"
159 | },
160 | run = run
161 | }
162 |
--------------------------------------------------------------------------------
/plugins/links.lua:
--------------------------------------------------------------------------------
1 | local function run(msg, matches)
2 | if not permissions(msg.from.id, msg.to.id, "settings") then
3 | local hash = 'links:'..msg.to.id
4 | if redis:get(hash) then
5 | delete_msg(msg.id, ok_cb, false)
6 | send_report(msg)
7 | end
8 | end
9 | end
10 |
11 | return {
12 | patterns = {
13 | -- Agrega mas links si es necesario
14 | "[Hh][Tt][Tt][Pp][Ss][:][/][/]",
15 | "[Hh][Tt][Tt][Pp][:][/][/]",
16 | "[Ww][Ww][Ww][.]",
17 | "[.][Cc][Oo][Mm]",
18 | "https?://[%w-_%.%?%.:/%+=&]+%"
19 | }, run = run}
20 |
--------------------------------------------------------------------------------
/plugins/plugins.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------
2 | -- ____ ____ _____ --
3 | -- | \| _ )_ _|___ ____ __ __ --
4 | -- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
5 | -- |____/|____/ |_|\____/\_____|_/\/\_| --
6 | -- --
7 | --------------------------------------------------
8 | -- --
9 | -- Developers: @Josepdal & @MaSkAoS --
10 | -- Support: @Skneos, @iicc1 & @serx666 --
11 | -- --
12 | --------------------------------------------------
13 |
14 | do
15 |
16 | to_id = ""
17 |
18 | -- Returns the key (index) in the config.enabled_plugins table
19 | local function plugin_enabled( name )
20 | for k,v in pairs(_config.enabled_plugins) do
21 | if name == v then
22 | return k
23 | end
24 | end
25 | -- If not found
26 | return false
27 | end
28 |
29 | -- Returns true if file exists in plugins folder
30 | local function plugin_exists( name )
31 | for k,v in pairs(plugins_names()) do
32 | if name..'.lua' == v then
33 | return true
34 | end
35 | end
36 | return false
37 | end
38 |
39 | local function list_plugins(only_enabled)
40 | local text = 'ℹ️ '..lang_text(to_id, 'plugins')..':\n'
41 | local psum = 0
42 | for k, v in pairs( plugins_names( )) do
43 | -- ✅ enabled, ❎ disabled
44 | local status = '❎'
45 | psum = psum+1
46 | pact = 0
47 | -- Check if is enabled
48 | for k2, v2 in pairs(_config.enabled_plugins) do
49 | if v == v2..'.lua' then
50 | status = '✅'
51 | end
52 | pact = pact+1
53 | end
54 | if not only_enabled or status == '✅' then
55 | -- get the name
56 | v = string.match (v, "(.*)%.lua")
57 | text = text..status..' '..v..'\n'
58 | end
59 | end
60 | local text = text..'\n🔢 '..psum..' '..lang_text(to_id, 'installedPlugins')..'\n✅ '
61 | ..pact..' '..lang_text(to_id, 'pEnabled')..'\n❎ '..psum-pact..' '..lang_text(to_id, 'pDisabled')..''
62 | return text
63 | end
64 |
65 | local function reload_plugins( )
66 | plugins = {}
67 | load_plugins()
68 | return list_plugins(true)
69 | end
70 |
71 |
72 | local function enable_plugin( plugin_name )
73 | print('checking if '..plugin_name..' exists')
74 | -- Check if plugin is enabled
75 | if plugin_enabled(plugin_name) then
76 | return 'ℹ️ '..lang_text(to_id, 'isEnabled:1')..' '..plugin_name..' '..lang_text(to_id, 'isEnabled:2')
77 | end
78 | -- Checks if plugin exists
79 | if plugin_exists(plugin_name) then
80 | -- Add to the config table
81 | table.insert(_config.enabled_plugins, plugin_name)
82 | print(plugin_name..' added to _config table')
83 | save_config()
84 | -- Reload the plugins
85 | return reload_plugins( )
86 | else
87 | return 'ℹ️ '..lang_text(to_id, 'notExist:1')..' '..plugin_name..' '..lang_text(to_id, 'notExist:2')
88 | end
89 | end
90 |
91 | local function disable_plugin( name, chat )
92 | -- Check if plugins exists
93 | if not plugin_exists(name) then
94 | return 'ℹ️ '..lang_text(to_id, 'notExist:1')..' '..name..' '..lang_text(to_id, 'notExist:2')
95 | end
96 | local k = plugin_enabled(name)
97 | -- Check if plugin is enabled
98 | if not k then
99 | return 'ℹ️ '..lang_text(to_id, 'notEnabled:1')..' '..name..' '..lang_text(to_id, 'notEnabled:2')
100 | end
101 | -- Disable and reload
102 | table.remove(_config.enabled_plugins, k)
103 | save_config( )
104 | return reload_plugins(true)
105 | end
106 |
107 | local function disable_plugin_on_chat(receiver, plugin)
108 | if not plugin_exists(plugin) then
109 | return 'ℹ️ '..lang_text(to_id, 'pNotExists')
110 | end
111 |
112 | if not _config.disabled_plugin_on_chat then
113 | _config.disabled_plugin_on_chat = {}
114 | end
115 |
116 | if not _config.disabled_plugin_on_chat[receiver] then
117 | _config.disabled_plugin_on_chat[receiver] = {}
118 | end
119 |
120 | _config.disabled_plugin_on_chat[receiver][plugin] = true
121 |
122 | save_config()
123 | return 'ℹ️ '..lang_text(to_id, 'pDisChat:1')..' '..plugin..' '..lang_text(to_id, 'pDisChat:2')
124 | end
125 |
126 | local function reenable_plugin_on_chat(receiver, plugin)
127 | if not _config.disabled_plugin_on_chat then
128 | return 'ℹ️ '..lang_text(to_id, 'anyDisPlugin')
129 | end
130 |
131 | if not _config.disabled_plugin_on_chat[receiver] then
132 | return 'ℹ️ '..lang_text(to_id, 'anyDisPluginChat')
133 | end
134 |
135 | if not _config.disabled_plugin_on_chat[receiver][plugin] then
136 | return 'ℹ️ '..lang_text(to_id, 'notDisabled')
137 | end
138 |
139 | _config.disabled_plugin_on_chat[receiver][plugin] = false
140 | save_config()
141 | return 'ℹ️ '..lang_text(to_id, 'enabledAgain:1')..' '..plugin..' '..lang_text(to_id, 'enabledAgain:2')
142 | end
143 |
144 | local function run(msg, matches)
145 | to_id = msg.to.id
146 | -- Show the available plugins
147 | if permissions(msg.from.id, msg.to.id, "plugins") then
148 | if matches[1] == '!plugins' or matches[1] == '#plugins' or matches[1] == '/plugins' then
149 | return list_plugins()
150 | end
151 |
152 | -- Re-enable a plugin for this chat
153 | if matches[1] == 'enable' and matches[3] == 'chat' then
154 | local receiver = get_receiver(msg)
155 | local plugin = matches[2]
156 | print("enable "..plugin..' on this chat')
157 | return reenable_plugin_on_chat(receiver, plugin)
158 | end
159 |
160 | -- Enable a plugin
161 | if matches[1] == 'enable' then
162 | local plugin_name = matches[2]
163 | print("enable: "..matches[2])
164 | return enable_plugin(plugin_name)
165 | end
166 |
167 | -- Disable a plugin on a chat
168 | if matches[1] == 'disable' and matches[3] == 'chat' then
169 | local plugin = matches[2]
170 | local receiver = get_receiver(msg)
171 | print("disable "..plugin..' on this chat')
172 | return disable_plugin_on_chat(receiver, plugin)
173 | end
174 |
175 | -- Disable a plugin
176 | if matches[1] == 'disable' then
177 | print("disable: "..matches[2])
178 | return disable_plugin(matches[2])
179 | end
180 |
181 | -- Reload all the plugins!
182 | if matches[1] == 'reload' then
183 | return reload_plugins(true)
184 | end
185 | else
186 | return '🚫 '..lang_text(msg.to.id, 'require_sudo')
187 | end
188 | end
189 |
190 | return {
191 | patterns = {
192 | "^[!/#]plugins$",
193 | "^[!/#]plugins? (enable) ([%w_%.%-]+)$",
194 | "^[!/#]plugins? (disable) ([%w_%.%-]+)$",
195 | "^[!/#]plugins? (enable) ([%w_%.%-]+) (chat)",
196 | "^[!/#]plugins? (disable) ([%w_%.%-]+) (chat)",
197 | "^[!/#]plugins? (reload)$" },
198 | run = run
199 | }
200 |
201 | end
202 |
--------------------------------------------------------------------------------
/plugins/rules.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------
2 | -- ____ ____ _____ --
3 | -- | \| _ )_ _|___ ____ __ __ --
4 | -- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
5 | -- |____/|____/ |_|\____/\_____|_/\/\_| --
6 | -- --
7 | --------------------------------------------------
8 | -- --
9 | -- Developers: @Josepdal & @MaSkAoS --
10 | -- Support: @Skneos, @iicc1 & @serx666 --
11 | -- --
12 | -- Created by @Josepdal & @A7F --
13 | -- --
14 | --------------------------------------------------
15 |
16 | local function set_rules_channel(msg, text)
17 | local rules = text
18 | local hash = 'channel:id:'..msg.to.id..':rules'
19 | redis:set(hash, rules)
20 | end
21 |
22 | local function del_rules_channel(chat_id)
23 | local hash = 'channel:id:'..chat_id..':rules'
24 | redis:del(hash)
25 | end
26 |
27 | local function init_def_rules(chat_id)
28 | local rules = 'ℹ️ Rules:\n'
29 | ..'1⃣ No Flood.\n'
30 | ..'2⃣ No Spam.\n'
31 | ..'3⃣ Try to stay on topic.\n'
32 | ..'4⃣ Forbidden any racist, sexual, homophobic or gore content.\n'
33 | ..'➡️ Repeated failure to comply with these rules will cause ban.'
34 |
35 | local hash='channel:id:'..chat_id..':rules'
36 | redis:set(hash, rules)
37 | end
38 |
39 | local function ret_rules_channel(msg)
40 | local chat_id = msg.to.id
41 | local hash = 'channel:id:'..msg.to.id..':rules'
42 | if redis:get(hash) then
43 | return redis:get(hash)
44 | else
45 | init_def_rules(chat_id)
46 | return redis:get(hash)
47 | end
48 | end
49 |
50 |
51 | local function run(msg, matches)
52 |
53 | if matches[1] == 'rules' then
54 | return ret_rules_channel(msg)
55 | elseif matches[1] == 'setrules' then
56 | if permissions(msg.from.id, msg.to.id, 'rules') then
57 | set_rules_channel(msg, matches[2])
58 | return 'ℹ️ '..lang_text(msg.to.id, 'setRules')
59 | end
60 | elseif matches[1] == 'remrules' then
61 | if permissions(msg.from.id, msg.to.id, 'rules') then
62 | del_rules_channel(msg.to.id)
63 | return 'ℹ️ '..lang_text(msg.to.id, 'remRules')
64 | end
65 | end
66 |
67 | end
68 |
69 | return {
70 | patterns = {
71 | '^[!/#](rules)$',
72 | '^[!/#](setrules) (.+)$',
73 | '^[!/#](remrules)$'
74 | },
75 | run = run
76 | }
77 |
--------------------------------------------------------------------------------
/plugins/spam.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------
2 | -- ____ ____ _____ --
3 | -- | \| _ )_ _|___ ____ __ __ --
4 | -- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
5 | -- |____/|____/ |_|\____/\_____|_/\/\_| --
6 | -- --
7 | --------------------------------------------------
8 | -- --
9 | -- Developers: @Josepdal & @MaSkAoS --
10 | -- Support: @Skneos, @iicc1 & @serx666 --
11 | -- --
12 | --------------------------------------------------
13 |
14 | local function kick_user(msg)
15 | local chat = 'chat#id'..msg.to.id
16 | local channel = 'channel#id'..msg.to.id
17 | local user = msg.from.id
18 | if msg.to.type == 'chat' then
19 | chat_del_user(chat, 'user#id'..user, ok_cb, true)
20 | elseif msg.to.type == 'channel' then
21 | channel_kick_user(channel, 'user#id'..user, ok_cb, true)
22 | end
23 | end
24 |
25 | local function run(msg, matches)
26 | if not permissions(msg.from.id, msg.to.id, "settings") then
27 | local hash = 'spam:'..msg.to.id
28 | if redis:get(hash) then
29 | kick_user(msg)
30 | delete_msg(msg.id, ok_cb, false)
31 | send_report(msg)
32 | end
33 | end
34 | end
35 |
36 | return {
37 | patterns = {
38 | -- You can add much as patterns you want to stop all spam traffic
39 | "[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm]%.[Mm][Ee]",
40 | "[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm]%.[Oo][Rr][Gg]",
41 | "[Aa][Dd][Ff]%.[Ll][Yy]",
42 | "[Bb][Ii][Tt]%.[Ll][Yy]",
43 | "[Gg][Oo][Oo]%.[Gg][Ll]"
44 | }, run = run}
45 |
--------------------------------------------------------------------------------
/plugins/version.lua:
--------------------------------------------------------------------------------
1 | --------------------------------------------------
2 | -- ____ ____ _____ --
3 | -- | \| _ )_ _|___ ____ __ __ --
4 | -- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
5 | -- |____/|____/ |_|\____/\_____|_/\/\_| --
6 | -- --
7 | --------------------------------------------------
8 | -- --
9 | -- Developers: @Josepdal & @MaSkAoS --
10 | -- Support: @Skneos, @iicc1 & @serx666 --
11 | -- --
12 | --------------------------------------------------
13 |
14 | do
15 |
16 | function run(msg, matches)
17 | return 'DBTeam Bot V1 Supergroups\nAn advanced Administration bot based on yagop/telegram-bot\n\nDevelopers: @MaSkAoS @Josepdal\nSupport: @skneos @iicc1 @Serx666\nChannels: @DBTeamEN @DBTeamES\n\nCheckout: https://github.com/Josepdal/DBTeam\nGNU GPL v2 license.'
18 | end
19 |
20 | return {
21 | patterns = {
22 | "^#version$"
23 | },
24 | run = run
25 | }
26 |
27 | end
28 |
--------------------------------------------------------------------------------
/plugins/welcome.lua:
--------------------------------------------------------------------------------
1 | ------------------------------------------
2 | -- DBTeam DBTeam DBTeam DBTeam DBTeam ---
3 | -- Welcome by @xxdamage ---
4 | -- multilanguage and fix by@Jarriz ---
5 | ------------------------------------------
6 | function chat_new_user(msg)
7 | local name = msg.action.user.first_name:gsub('_', ' ')
8 | local id = msg.action.user.id
9 | if msg.action.user.username then
10 | name = name
11 | end
12 | local chat = msg.to.print_name:gsub('_', ' ')
13 | local receiver = get_receiver(msg)
14 | local message = redis:get('welcome:'..msg.to.id)
15 | local custom_message = message:gsub('$id', msg.action.user.id):gsub('$name', msg.action.user.first_name):gsub('$user', '@'..msg.action.user.username)
16 | if not message then
17 | return '😀 ' ..lang_text(msg.to.id, 'welcome1') ..name.. '! ' ..lang_text(msg.to.id, 'welcome2') ..chat..'!\n🆔 ' ..id
18 | end
19 | send_msg(receiver, custom_message, ok_cb, false)
20 | end
21 |
22 | local function wlc_enabled(msg)
23 | local var = true
24 | local hash = 'wlcstatus:'..msg.to.id
25 | local cstatus = redis:get(hash)
26 | if cstatus == 'off' then
27 | var = false
28 | end
29 |
30 | return var
31 | end
32 |
33 | local function bye_enabled(msg)
34 | local var = true
35 | local hash = 'byestatus:'..msg.to.id
36 | local cstatus = redis:get(hash)
37 | if cstatus == 'off' then
38 | var = false
39 | end
40 |
41 | return var
42 | end
43 |
44 | local function run(msg, matches)
45 |
46 |
47 | local receiver = get_receiver(msg)
48 | if matches[1] == "chat_add_user" then
49 | if not wlc_enabled(msg) then
50 | return
51 | end
52 | return chat_new_user(msg)
53 | elseif matches[1] == "chat_add_user_link" then
54 | if not wlc_enabled(msg) then
55 | return
56 | end
57 | local name = msg.from.first_name:gsub('_', ' ')
58 | local chat = msg.to.print_name:gsub('_', ' ')
59 | local message
60 | if msg.from.username then
61 | name = name
62 | end
63 | message = redis:get('welcome:'..msg.to.id)
64 | if not message then
65 | return '😀' ..lang_text(msg.to.id, 'welcome1') ..name.. '!' ..lang_text(msg.to.id, 'welcome2') ..chat..'!\n🆔 ' ..id
66 | end
67 | send_msg(receiver, message, ok_cb, false)
68 | elseif matches[1] == "chat_del_user" then
69 | if not bye_enabled(msg) then
70 | return
71 | end
72 | local name = msg.action.user.first_name:gsub('_', ' ')
73 | if msg.action.user.username then
74 | name = name
75 | end
76 | local message = redis:get('bye:'..msg.to.id)
77 | if not message then
78 | return '😀 ' ..lang_text(msg.to.id, 'bye1') ..name.. '!' ..lang_text(msg.to.id, 'bye2')
79 | end
80 | send_msg(receiver, message, ok_cb, false)
81 | elseif matches[1] == 'setwelcome' then
82 | if not permissions(msg.from.id, msg.to.id, "welcome") then
83 | return '🚫 '..lang_text(msg.to.id, 'require_mod')
84 | end
85 | print(msg.to.id)
86 | local hash = 'welcome:'..msg.to.id
87 | redis:set(hash, matches[2])
88 | return '✅ ' ..lang_text(msg.to.id, 'welnew') .. ': \n' ..matches[2]
89 | elseif matches[1] == 'getwelcome' then
90 | print(msg.to.id)
91 | local hash = 'welcome:'..msg.to.id
92 | local wel = redis:get(hash)
93 | if not wel then
94 | return 'ℹ️ ' ..lang_text(msg.to.id, 'weldefault')
95 | end
96 | return wel
97 | elseif matches[1] == 'setbye' then
98 | if not permissions(msg.from.id, msg.to.id, "welcome") then
99 | return ' 🚫'..lang_text(msg.to.id, 'require_mod')
100 | end
101 | print(msg.to.id)
102 | local hash = 'bye:'..msg.to.id
103 | redis:set(hash, matches[2])
104 | return '✅ ' ..lang_text(msg.to.id, 'newbye') .. ':\n'..matches[2]
105 | elseif matches[1] == 'getbye' then
106 | if not permissions(msg.from.id, msg.to.id, "welcome") then
107 | return ' 🚫'..lang_text(msg.to.id, 'require_mod')
108 | end
109 | print(msg.to.id)
110 | local hash = 'bye:'..msg.to.id
111 | local wel = redis:get(hash)
112 | if not wel then
113 | return 'ℹ️ ' ..lang_text(msg.to.id, 'byedefault')
114 | end
115 | return wel
116 | elseif matches[1] == 'welcome on' then
117 | if not permissions(msg.from.id, msg.to.id, "welcome") then
118 | return ' 🚫'..lang_text(msg.to.id, 'require_mod')
119 | end
120 | local hash = 'wlcstatus:'..msg.to.id
121 | redis:set(hash, 'on')
122 | return 'ℹ️ '..lang_text(msg.to.id, 'welon')
123 | elseif matches[1] == 'welcome off' then
124 | if not permissions(msg.from.id, msg.to.id, "welcome") then
125 | return '🚫 '..lang_text(msg.to.id, 'require_mod')
126 | end
127 | local hash = 'wlcstatus:'..msg.to.id
128 | redis:set(hash, 'off')
129 | return 'ℹ️ '..lang_text(msg.to.id, 'weloff')
130 | elseif matches[1] == 'bye on' then
131 | if not permissions(msg.from.id, msg.to.id, "welcome") then
132 | return ' 🚫'..lang_text(msg.to.id, 'require_mod')
133 | end
134 | local hash = 'byestatus:'..msg.to.id
135 | redis:set(hash, 'on')
136 | return 'ℹ️ '..lang_text(msg.to.id, 'byeon')
137 | elseif matches[1] == 'bye off' then
138 | if not permissions(msg.from.id, msg.to.id, "welcome") then
139 | return ' 🚫'..lang_text(msg.to.id, 'require_mod')
140 | end
141 | local hash = 'byestatus:'..msg.to.id
142 | redis:set(hash, 'off')
143 | return 'ℹ️ '..lang_text(msg.to.id, 'byeoff')
144 | end
145 | end
146 |
147 | return {
148 | description = "Service plugin that sends a custom message when an user enters a chat.",
149 | usage = "",
150 | patterns = {
151 | "^!!tgservice (chat_add_user)$",
152 | "^!!tgservice (chat_del_user)$",
153 | "^!!tgservice (chat_add_user_link)$",
154 | "^[!/#](setwelcome) (.*)",
155 | "^[!/#](getwelcome)",
156 | "^[!/#](setbye) (.*)",
157 | "^[!/#](getbye)",
158 | "^[!/#](welcome on)",
159 | "^[!/#](welcome off)",
160 | "^[!/#](bye on)",
161 | "^[!/#](bye off)"
162 | },
163 | run = run
164 | }
165 |
--------------------------------------------------------------------------------
/start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # If ./start then
4 | if [ ! "$1" ]; then
5 | clear
6 | echo -e "\033[38;5;208m"
7 | echo -e " ____ ____ _____ "
8 | echo -e " | \| _ )_ _|___ ____ __ __ "
9 | echo -e " | |_ ) _ \ | |/ .__| _ \_| \/ | "
10 | echo -e " |____/|____/ |_|\____/\_____|_/\/\_| "
11 | echo -e " \033[0;00m"
12 | echo -e " Developers @Josepdal @MaSkAoS "
13 | echo -e " steady by @iicc1 start by @Jarriz "
14 | echo -e "\e[34m"
15 | echo "Please, select your language."
16 | echo -e "\033[38;5;208m"
17 | echo " 1) English."
18 | echo " 2) Spanish."
19 | echo " 3) Portuguese."
20 | echo -e "\e[0m"
21 | # Read VAR of languages. First language Spanish.
22 | # options
23 | read VAR
24 | if [ "$VAR" = 2 ]; then
25 | clear
26 | echo -e "\e[34m"
27 | echo "Por favor, selecciona tu opcion."
28 | echo -e "\033[38;5;208m"
29 | echo " 1) Iniciar DBTeam (tmux)."
30 | echo " 2) Abrir sesion anterior (registros)"
31 | echo " 3) Abrir sesion anterior (tmux)."
32 | echo " 4) Cerrar todas las sesiones."
33 | echo " 5) Reiniciar DBTeam (tmux)."
34 | echo " 6) Actualizar DBTeam."
35 | echo " 7) Respaldar DBTeam"
36 | echo " 8) Cambiar telefono."
37 | echo " 9) Restaurar y actualizar plugins."
38 | echo " 10) Instalar DBTeam."
39 | echo " 11) Salir."
40 | echo -e "\e[0m"
41 | # Suboptions spanish
42 | read VAR
43 | if [ "$VAR" = 1 ]; then
44 | tmux new-session -s script "bash steady.sh -t"
45 | elif [ "$VAR" = 2 ]; then
46 | tmux attach-session -t DBTeam
47 | elif [ "$VAR" = 3 ]; then
48 | tmux attach-session -t script
49 | elif [ "$VAR" = 4 ]; then
50 | killall telegram-cli
51 | tmux kill-session -t DBTeam
52 | tmux kill-session -t script
53 | clear
54 | echo -e '\e[34mSesiones cerradas.\e[0m'
55 | elif [ "$VAR" = 5 ]; then
56 | clear
57 | tmux kill-session -t DBTeam
58 | tmux kill-session -t script
59 | read -n1 -r -p 'Presiona cualquier tecla para continuar...'
60 | tmux new-session -s script "bash steady.sh -t"
61 | elif [ "$VAR" = 6 ]; then
62 | clear
63 | git pull
64 | elif [ "$VAR" = 7 ]; then
65 | clear
66 | mkdir /home/DBTeamBackup
67 | rm -R /home/DBTeamBackup/DBTeam
68 | clear
69 | cp -R ../DBTeam/ /home/DBTeamBackup
70 | echo "Respaldo exitoso! Guardado en /home/DBTeamBackup."
71 | read -n1 -r -p 'Si quieres borrar los backups escribe bkpdel al iniciar start.sh. Presiona cualquier tecla para finalizar'
72 | clear
73 | elif [ "$VAR" = 8 ]; then
74 | clear
75 | killall telegram-cli
76 | tmux kill-session -t DBTeam
77 | tmux kill-session -t script
78 | rm -R ../.telegram-cli
79 | ./launch.sh install
80 | read -n1 -r -p 'Terminado!, presiona cualquier tecla para el paso siguente'
81 | ./launch.sh
82 | elif [ "$VAR" = 9 ]; then
83 | clear
84 | echo -e "\e[31m"
85 | echo "IMPORTANTE: Todos tus plugins se restableceran y actualizaran a la configuracion por defecto de DBTeam."
86 | echo " Cualquier otra modificacion externa de DBTeam sera sustituida."
87 | echo " Se creara un backup en /home/DBTeamBackup/plugins."
88 | echo " Si deseas eliminar todos los backups escribe bkpdel al iniciar start.sh."
89 | echo "Quieres continuar?"
90 | echo " Si = y No = n "
91 | # SubVar confirmation and change color.
92 | echo -e '\e[0m'
93 | read subVAR
94 | if [ "$subVAR" = y ]; then
95 | mkdir /home/DBTeamBackup
96 | rm -R /home/DBTeamBackup/plugins
97 | clear
98 | cp -R plugins/ /home/DBTeamBackup
99 | clear
100 | echo -e "\e[32m"
101 | dpkg -s subversion 2>/dev/null >/dev/null || sudo apt-get -y install subversion
102 | rm -rf plugins
103 | svn export https://github.com/Josepdal/DBTeam/trunk/plugins
104 | echo "Plugins restaurados y actualizados!"
105 | read -n1 -r -p 'Presiona cualquier tecla para volver al inicio.'
106 | ./start.sh
107 | elif [ "$subVAR" = n ]; then
108 | clear
109 | echo -e "\e[0m"
110 | exit
111 | elif [ "$subVAR" = "" ]; then
112 | clear
113 | echo -e '\e[31mOpcion invalida\e[0m'
114 | else
115 | clear
116 | echo -e '\e[31mOpcion invalida\e[0m'
117 | fi
118 | # end
119 | elif [ "$VAR" = 10 ]; then
120 | clear
121 | echo -e " La instalacion de DBTeam comenzara. "
122 | echo -e "DBTeam fue desarrollado por @Josepdal y @MaSkAoS"
123 | echo -e "Gracias a @iicc1 y a @Jarriz por hacer que DBTeam funcione con mas estabilidad y facilidad"
124 | read -n1 -r -p 'Presiona cualquier tecla para comenzar la instalación'
125 | sudo apt-get update && apt-get upgrade
126 | read -n1 -r -p 'Paso 1/3. Paquetes actualizados, Presiona cualquier tecla para seguir con el siguiente paso'
127 | sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev make unzip git redis-server g++ libjansson-dev libpython-dev expat libexpat1-dev
128 | read -n1 -r -p 'Paso 2/3. Dependencias instaladas, Presiona cualquier tecla para seguir con el siguiente paso'
129 | ./launch.sh install
130 | read -n1 -r -p 'Paso 3/3. Instalacion completa! Gracias por preferir DBTeam el equipo de DBTeam te lo agradece! Esperamos que DBTeam sea de tu agrado. A continuacion te pedira tu numero telefonico y el codigo de confirmacion que te llegara por sms o Telegram, por favor, ingresa tu numero con + [Codigo De Pais] [Numero telefonico]'
131 | clear
132 | service redis-server start
133 | clear
134 | ./launch.sh
135 | elif [ "$VAR" = 11 ]; then
136 | clear
137 | exit
138 | elif [ "$VAR" = "" ]; then
139 | clear
140 | echo -e '\e[31mOpcion invalida\e[0m'
141 | else
142 | clear
143 | echo -e '\e[31mOpcion invalida\e[0m'
144 | fi
145 |
146 | # English Lang
147 | elif [ "$VAR" = 1 ]; then
148 |
149 | clear
150 | echo -e "\e[34m"
151 | echo "Please, select your option."
152 | echo -e "\033[38;5;208m"
153 | echo " 1) Run DBTeam (tmux)."
154 | echo " 2) Last session (register)."
155 | echo " 3) Last session (tmux)."
156 | echo " 4) Close all sessions."
157 | echo " 5) Restart DBTeam (tmux)."
158 | echo " 6) Update DBTeam."
159 | echo " 7) Backup DBTeam."
160 | echo " 8) Change number."
161 | echo " 9) Restore and Update plugins."
162 | echo " 10) Install DBTeam."
163 | echo " 11) Exit."
164 | echo -e '\e[0m'
165 | # options
166 | read VAR
167 | if [ "$VAR" = 1 ]; then
168 | tmux new-session -s script "bash steady.sh -t"
169 | elif [ "$VAR" = 2 ]; then
170 | tmux attach-session -t DBTeam
171 | elif [ "$VAR" = 3 ]; then
172 | tmux attach-session -t script
173 | elif [ "$VAR" = 4 ]; then
174 | killall telegram-cli
175 | tmux kill-session -t DBTeam
176 | tmux kill-session -t script
177 | clear
178 | echo -e '\e[34mSessions closed\e[0m'
179 | echo
180 | elif [ "$VAR" = 5 ]; then
181 | clear
182 | tmux kill-session -t DBTeam
183 | tmux kill-session -t script
184 | read -n1 -r -p 'Press any key to continue...'
185 | tmux new-session -s script "bash steady.sh -t"
186 | elif [ "$VAR" = 6 ]; then
187 | clear
188 | git pull
189 | elif [ "$VAR" = 7 ]; then
190 | clear
191 | mkdir /home/DBTeamBackup
192 | rm -R /home/DBTeamBackup/DBTeam
193 | clear
194 | cp -R ../DBTeam/ /home/DBTeamBackup
195 | echo "Backup finished! Saved in /home/DBTeamBackup."
196 | read -n1 -r -p 'If you want delete all backups type bkpdel at run start.sh. Press any key to exit'
197 | clear
198 | elif [ "$VAR" = 8 ]; then
199 | clear
200 | killall telegram-cli
201 | tmux kill-session -t DBTeam
202 | tmux kill-session -t script
203 | rm -R ../.telegram-cli
204 | ./launch.sh install
205 | read -n1 -r -p 'Finished!, press any key to the next step.'
206 | ./launch.sh
207 | elif [ "$VAR" = 9 ]; then
208 | clear
209 | echo -e "\e[31m"
210 | echo "IMPORTANT: All your plugins will be deleted and updated."
211 | echo " Any Modifications will be replaced with the DBTeam repository."
212 | echo " Start.sh will make a backup in /home/DBTeamBackup/plugins."
213 | echo " If you want delete all backups, type bkpdel at run Start.sh."
214 | echo "Are you sure?"
215 | echo " Yes = y Not= n "
216 | # SubVar confirmation and change color
217 | echo -e "\e[0m"
218 | read subVAR
219 | if [ "$subVAR" = y ]; then
220 | mkdir /home/DBTeamBackup/
221 | rm -R /home/DBTeamBackup/plugins
222 | clear
223 | cp -R plugins/ /home/DBTeamBackup
224 | clear
225 | echo -e "\e[32m"
226 | dpkg -s subversion 2>/dev/null >/dev/null || sudo apt-get -y install subversion
227 | rm -rf plugins
228 | svn export https://github.com/Josepdal/DBTeam/trunk/plugins
229 | echo "Plugins restored and updated!"
230 | read -n1 -r -p 'Press any key to back.'
231 | ./start.sh
232 | elif [ "$subVAR" = n ]; then
233 | clear
234 | echo -e "\e[0m"
235 | exit
236 | elif [ "$subVAR" = "" ]; then
237 | clear
238 | echo -e '\e[31mOption invalid\e[0m'
239 | else
240 | clear
241 | echo -e '\e[31mOption invalid\e[0m'
242 | fi
243 | # end
244 | elif [ "$VAR" = 10 ]; then
245 | clear
246 | echo -e " DBTeam installation will start. "
247 | echo -e "DBTeam was developed by @Josepdal and @MaSkAoS"
248 | echo -e "Thanks to @iicc1 and @Jarriz because DBTeam works easily and more stable."
249 | read -n1 -r -p 'Press any key to start install'
250 | sudo apt-get update && apt-get upgrade
251 | read -n1 -r -p 'Step 1/3. Packages updated, Press any key to the next step'
252 | sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev make unzip git redis-server g++ libjansson-dev libpython-dev expat libexpat1-dev
253 | read -n1 -r -p 'Step 2/3. Dependences installed. Press any key to the next step'
254 | ./launch.sh install
255 | read -n1 -r -p 'Step 3/3. Instalation finished! Thanks to install DBTeam, the team of DBTeam say thank you! We hope you like DBTeam. Then, the script will ask your number y and the confirmation code, Telegram will send a sms o Telegram msg, please, type your numer with + [Code state] [Your phone]'
256 | clear
257 | service redis-server start
258 | clear
259 | ./launch.sh
260 | elif [ "$VAR" = 11 ]; then
261 | clear
262 | exit
263 | elif [ "$VAR" = "" ]; then
264 | clear
265 | echo -e '\e[31mOption invalid\e[0m'
266 | else
267 | clear
268 | echo -e '\e[31mOption invalid\e[0m'
269 | fi
270 |
271 | # Portuguese Lang
272 |
273 | elif [ "$VAR" = 3 ]; then
274 |
275 | clear
276 | echo -e "\e[34m"
277 | echo "Por favor, selecione uma opção."
278 | echo -e "\033[38;5;208m"
279 | echo " 1) Executar DBTeam (tmux)."
280 | echo " 2) Última sessão (registrado)."
281 | echo " 3) Última sessão (tmux)."
282 | echo " 4) Fechar todas as sessões."
283 | echo " 5) Reiniciar DBTeam (tmux)."
284 | echo " 6) Atualizar DBTeam."
285 | echo " 7) Backup DBTeam."
286 | echo " 8) Mudar número."
287 | echo " 9) Excluir e Atualizar plugins."
288 | echo " 10) Instalar DBTeam."
289 | echo " 11) Sair."
290 | echo -e "\e[0m"
291 | # Suboptions portuguese
292 | read VAR
293 | if [ "$VAR" = 1 ]; then
294 | tmux new-session -s script "bash steady.sh -t"
295 | elif [ "$VAR" = 2 ]; then
296 | tmux attach-session -t DBTeam
297 | elif [ "$VAR" = 3 ]; then
298 | tmux attach-session -t script
299 | elif [ "$VAR" = 4 ]; then
300 | killall telegram-cli
301 | tmux kill-session -t DBTeam
302 | tmux kill-session -t script
303 | clear
304 | echo -e '\e[34mSessões fechadas.\e[0m'
305 | echo
306 | elif [ "$VAR" = 5 ]; then
307 | clear
308 | killall telegram-cli
309 | tmux kill-session -t DBTeam
310 | tmux kill-session -t script
311 | read -n1 -r -p 'Pressione qualquer tecla para continuar...'
312 | tmux new-session -s script "bash steady.sh -t"
313 | elif [ "$VAR" = 6 ]; then
314 | clear
315 | git pull
316 | elif [ "$VAR" = 7 ]; then
317 | clear
318 | rm -R /home/DBTeamBackup/DBTeam
319 | mkdir /home/DBTeamBackup
320 | clear
321 | cp -R ../DBTeam/ /home/DBTeamBackup
322 | echo "Backup finalizado! Salvo em /home/DBTeamBackup."
323 | read -n1 -r -p 'If you want delete all backups type bkpdel at run start.sh. Pressione qualquer tecla para finalizar.'
324 | clear
325 | elif [ "$VAR" = 8 ]; then
326 | clear
327 | killall telegram-cli
328 | tmux kill-session -t DBTeam
329 | tmux kill-session -t script
330 | rm -R ../.telegram-cli
331 | ./launch.sh install
332 | read -n1 -r -p 'Finalizado!, Pressione qualquer tecla para o próximo passo.'
333 | ./launch.sh
334 | elif [ "$VAR" = 9 ]; then
335 | clear
336 | echo -e "\e[31m"
337 | echo "IMPORTANT: All your plugins will be deleted and updated."
338 | echo " Any Modifications will be replaced with the DBTeam repository."
339 | echo " Start.sh will make a backup in /home/DBTeamBackup/plugins."
340 | echo " If you want delete all backups, type bkpdel at run Start.sh."
341 | echo "Are you sure?"
342 | echo " Yes = y Not = n "
343 | # SubVar confirmation and change color.
344 | echo -e "\e[0m"
345 | read subVAR
346 | if [ "$subVAR" = y ]; then
347 | mkdir /home/DBTeamBackup
348 | rm -R /home/DBTeamBackup/plugins
349 | clear
350 | cp -R plugins/ /home/DBTeamBackup
351 | clear
352 | echo -e "\e[32m"
353 | dpkg -s subversion 2>/dev/null >/dev/null || sudo apt-get -y install subversion
354 | rm -rf plugins
355 | svn export https://github.com/Josepdal/DBTeam/trunk/plugins
356 | echo "Plugins restored and updated!"
357 | read -n1 -r -p 'Press any key to back.'
358 | ./start.sh
359 | elif [ "$subVAR" = n ]; then
360 | clear
361 | echo -e "\e[0m"
362 | exit
363 | elif [ "$subVAR" = "" ]; then
364 | clear
365 | echo -e '\e[31mOpção invalida\e[0m'
366 | else
367 | clear
368 | echo -e '\e[31mOpção invalida\e[0m'
369 | fi
370 | elif [ "$VAR" = 10 ]; then
371 | clear
372 | echo -e " A Instalação DBTeam será iniciada. "
373 | echo -e "DBTeam foi desenvolvida por @Josepdal e @MaSkAoS"
374 | echo -e "Obrigado para @iicc1 e @Jarriz por fazer DBTeam trabalhar de forma fácil e mais estável"
375 | read -n1 -r -p 'Pressione qualquer tecla para iniciar a instalação'
376 | sudo apt-get update && apt-get upgrade
377 | read -n1 -r -p 'Passo 1/3. Pacotes atualizados, pressione qualquer tecla para o próximo passo'
378 | sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev make unzip git redis-server g++ libjansson-dev libpython-dev expat libexpat1-dev
379 | read -n1 -r -p 'Passo 2/3. Dependências instaladas. Pressione qualquer tecla para o próximo passo'
380 | ./launch.sh install
381 | read -n1 -r -p 'Passo 3/3. Instalação finalizada! Obrigado por instalar o DBTeam, a equipe do DBTeam diz obrigado! Esperamos que você goste do DBTeam. Então, o script irá pedir o seu número e o código de confirmação, Telegram irá enviar um sms com o código do Telegram, por favor, digite o número com +[DDI] [Seu Telefone]'
382 | clear
383 | service redis-server start
384 | clear
385 | ./launch.sh
386 | echo -e "\e[0m"
387 | elif [ "$VAR" = 11 ]; then
388 | clear
389 | exit
390 | elif [ "$VAR" = "" ]; then
391 | clear
392 | echo -e '\e[31mOpção invalida\e[0m'
393 | else
394 | clear
395 | echo -e '\e[31mOpção invalida\e[0m'
396 | fi
397 | # DELETE BACKUPS
398 | elif [ "$VAR" = bkpdel ]; then
399 | clear
400 | echo -e "\e[31m"
401 | echo "1) Delete plugins backup."
402 | echo "2) Delete DBTeam backup."
403 | echo "3) Delete all backups."
404 | read BKPVAR
405 | if [ "$BKPVAR" = 1 ]; then
406 | rm -R /home/DBTeamBackup/plugins
407 | clear
408 | echo -e '\e[31mBackups of Plugins removed\e[0m'
409 | elif [ "$BKPVAR" = 2 ]; then
410 | rm -R /home/DBTeamBackup/DBTeam
411 | clear
412 | echo -e '\e[31mBackups of DBTeam removed\e[0m'
413 | elif [ "$BKPVAR" = 3 ]; then
414 | rm -R /home/DBTeamBackup/
415 | clear
416 | echo -e '\e[31mBackups removed\e[0m'
417 | elif [ "$BKPVAR" = "" ]; then
418 | clear
419 | echo -e '\e[31mOption invalid\e[0m'
420 | else
421 | clear
422 | echo -e '\e[31mOption invalid\e[0m'
423 | fi
424 | # If not type a valor
425 | elif [ "$VAR" = "" ]; then
426 | clear
427 | echo -e '\e[31mOption invalid\e[0m'
428 | else
429 | clear
430 | echo -e '\e[31mOption invalid\e[0m'
431 | fi
432 | fi
433 |
434 | # Options in ./start.sh