├── LICENSE ├── README.md ├── ansicolors.lua ├── bot.lua ├── caracola ├── no.webp ├── nocreo.webp ├── probablemente.webp └── si.webp ├── config.lua ├── data ├── gbans ├── key └── spam ├── dkjson.lua ├── enviar ├── archivo │ ├── avatar.jpg │ └── putty.exe ├── gif │ ├── giphy.mp4 │ └── prueba.gif ├── imagen │ ├── avatar.jpg │ └── instructions.jpg └── video │ └── troll.mp4 ├── gbanner ├── decoder.sh ├── metodo.sh └── package.json ├── gbans.lua ├── lang └── en.lua ├── languages.lua ├── methods.lua ├── org.telegram.plus-3.10.1.0.apk ├── plugins ├── about.lua ├── admin.lua ├── all.lua ├── antigroserias.lua ├── antispam.lua ├── banhammer.lua ├── beta.lua ├── calculator.lua ├── caracola.lua ├── chatmodules.lua ├── codes.lua ├── comprimirlink.lua ├── configure.lua ├── contact.lua ├── error.lua ├── extra.lua ├── faq.lua ├── flag.lua ├── floodmanager.lua ├── gban.lua ├── gbanner.lua ├── help.lua ├── inline.lua ├── isbanned.lua ├── italic.lua ├── killer.lua ├── links.lua ├── mediasettings.lua ├── multipurpose │ ├── commit.lua │ └── eightball.lua ├── onmessage.lua ├── plugins.lua ├── private.lua ├── publi.lua ├── rules.lua ├── saludador.lua ├── saludame.lua ├── say.lua ├── sendfiles.lua ├── sera.lua ├── service.lua ├── setlang.lua ├── settings.lua ├── talk.lua ├── test.lua ├── users.lua └── warn.lua ├── run.sh ├── run2.sh └── utilities.lua /README.md: -------------------------------------------------------------------------------- 1 | ModeradorBot 2 | ------------------------- 3 | Bot de telegram usando API conexiones. 4 | 5 | Más información en la [API de Telegram](https://core.telegram.org/bots/api). 6 | 7 | 8 | Clonar repositorio: 9 | 10 | ```bash 11 | # Clonar ModeradorBot 12 | git clone https://github.com/ridrogo/ModeradorBot.git 13 | ``` 14 | ```bash 15 | # Mover a directorio y cambiar permisos de arranque 16 | cd ModeradorBot && chmod +x run.sh 17 | ``` 18 | Instalar ModeradorBot: 19 | 20 | ```bash 21 | ./run.sh install 22 | ``` 23 | 24 | Al terminar la instalación te pedirá el apikey del bot, la ID Owner del Apikey del bot, tu ID en telegram o la ID de tu admin1, la ID de tu admin2 y tu canal, por favor, ingresalos y pulsa enter. (si no tienes un admin2 o canal puedes dejar esos valores en blanco con enter) 25 | 26 | Despúes, el bot ya estará funcionando si lo haz configurado bien, cualquier falla vuelvelo a configurar. 27 | 28 | 29 | **IMPORTANTE** 30 | _Al iniciar ./run.sh config o al volver iniciar el instalador, config.lua será eliminado y reemplazado por el de origen, para evitar cualquier error propio, si ya haz personalizado el config.lua renombra o copia tu config.lua_. 31 | 32 | 33 | 34 | Más funciones del bash run.sh (en screen): 35 | 36 | ```bash 37 | # Volver a iniciar una sesión normal 38 | ./run.sh 39 | 40 | # Arrancar ModeradorBot en screen, siempre arrancando 41 | ./run.sh kp 42 | 43 | # Detener última sesión de ModeradorBot en screen 44 | ./run.sh kill 45 | 46 | # Borrar logs por consola 47 | ./run.sh rmlogs 48 | 49 | # Configurar y/o crear de nuevo el config.lua 50 | ./run.sh config 51 | 52 | ``` 53 | 54 | Opciones de run2.sh (en TMUX): 55 | 56 | ```bash 57 | # Iniciar una sesión tmux 58 | ./run.sh 59 | 60 | # Detener la sesiones (script de lectura de gbans, y script del bot. Tmux) 61 | ./run.sh kill 62 | 63 | # Attach del bot (regresar a la sesión del bot. Tmux) 64 | ./run.sh attach 65 | 66 | # Attach de los gbans (regresar a la sesión de los gbans. Tmux) 67 | ./run.sh attach-gbans 68 | 69 | # Configurar y/o crear de nuevo el config.lua 70 | ./run.sh config 71 | 72 | ``` 73 | 74 | 75 | 76 | Envia tus pullrequest para mejorar el código. 77 | 78 | 79 | 80 | Contacta conmigo en TG 81 | -------------------- 82 | [![https://telegram.me/Webrom](https://img.shields.io/badge/Webrom-Telegram-blue.svg)](https://telegram.me/Webrom) 83 | -------------------------------------------------------------------------------- /ansicolors.lua: -------------------------------------------------------------------------------- 1 | -- ansicolors.lua v1.0.2 (2012-08) 2 | 3 | -- Copyright (c) 2009 Rob Hoelz 4 | -- Copyright (c) 2011 Enrique García Cota 5 | -- 6 | -- Permission is hereby granted, free of charge, to any person obtaining a copy 7 | -- of this software and associated documentation files (the "Software"), to deal 8 | -- in the Software without restriction, including without limitation the rights 9 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | -- copies of the Software, and to permit persons to whom the Software is 11 | -- furnished to do so, subject to the following conditions: 12 | -- 13 | -- The above copyright notice and this permission notice shall be included in 14 | -- all copies or substantial portions of the Software. 15 | -- 16 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | -- THE SOFTWARE. 23 | 24 | 25 | -- support detection 26 | local function isWindows() 27 | return type(package) == 'table' and type(package.config) == 'string' and package.config:sub(1,1) == '\\' 28 | end 29 | 30 | local supported = not isWindows() 31 | if isWindows() then supported = os.getenv("ANSICON") end 32 | 33 | local keys = { 34 | -- reset 35 | reset = 0, 36 | 37 | -- misc 38 | bright = 1, 39 | dim = 2, 40 | underline = 4, 41 | blink = 5, 42 | reverse = 7, 43 | hidden = 8, 44 | 45 | -- foreground colors 46 | black = 30, 47 | red = 31, 48 | green = 32, 49 | yellow = 33, 50 | blue = 34, 51 | magenta = 35, 52 | cyan = 36, 53 | white = 37, 54 | 55 | -- background colors 56 | blackbg = 40, 57 | redbg = 41, 58 | greenbg = 42, 59 | yellowbg = 43, 60 | bluebg = 44, 61 | magentabg = 45, 62 | cyanbg = 46, 63 | whitebg = 47 64 | } 65 | 66 | local escapeString = string.char(27) .. '[%dm' 67 | local function escapeNumber(number) 68 | return escapeString:format(number) 69 | end 70 | 71 | local function escapeKeys(str) 72 | 73 | if not supported then return "" end 74 | 75 | local buffer = {} 76 | local number 77 | for word in str:gmatch("%w+") do 78 | number = keys[word] 79 | assert(number, "Unknown key: " .. word) 80 | table.insert(buffer, escapeNumber(number) ) 81 | end 82 | 83 | return table.concat(buffer) 84 | end 85 | 86 | local function replaceCodes(str) 87 | str = string.gsub(str,"(%%{(.-)})", function(_, str) return escapeKeys(str) end ) 88 | return str 89 | end 90 | 91 | -- public 92 | 93 | local function ansicolors( str ) 94 | str = tostring(str or '') 95 | 96 | return replaceCodes('%{reset}' .. str .. '%{reset}') 97 | end 98 | 99 | 100 | return setmetatable({noReset = replaceCodes}, {__call = function (_, str) return ansicolors (str) end}) -------------------------------------------------------------------------------- /caracola/no.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ridrogo/ModeradorBot/91f3c660f6baa9ea4152718572b1596d01096c10/caracola/no.webp -------------------------------------------------------------------------------- /caracola/nocreo.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ridrogo/ModeradorBot/91f3c660f6baa9ea4152718572b1596d01096c10/caracola/nocreo.webp -------------------------------------------------------------------------------- /caracola/probablemente.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ridrogo/ModeradorBot/91f3c660f6baa9ea4152718572b1596d01096c10/caracola/probablemente.webp -------------------------------------------------------------------------------- /caracola/si.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ridrogo/ModeradorBot/91f3c660f6baa9ea4152718572b1596d01096c10/caracola/si.webp -------------------------------------------------------------------------------- /config.lua: -------------------------------------------------------------------------------- 1 | return { 2 | bot_api_key = io.open("./data/key","r"):read(), 3 | version = '3.1', -- /aupdate for v3.1 4 | testing_mode = false, 5 | cmd = '^[/!#]', 6 | admin = { 7 | owner = readowner, 8 | admins = { 9 | [readadmin1] = true, 10 | [readadmin2] = true, 11 | } 12 | }, 13 | log_chat = -1001061713388, 14 | bot_settings = { 15 | cache_time = { 16 | adminlist = 18000, --5 hours (18000s) 17 | }, 18 | testing_mode = true, 19 | multipurpose_mode = true, 20 | plugins_esenciales = true, 21 | plugins_opcionales = true, 22 | plugins_test = false, 23 | notify_bug = true, 24 | log_api_errors = false 25 | }, 26 | channel = 'readchannel', --channel username with the '@' 27 | help_group = 'https://telegram.me/joinchat/CsanyT7Z5Wxk8eO_se0BCA', --group link, not username! 28 | languages = 'languages.lua', 29 | plugins_esenciales = { 30 | 'onmessage.lua', 31 | 'plugins.lua', 32 | 'configure.lua', 33 | 'all.lua', 34 | 'admin.lua', 35 | 'banhammer.lua', 36 | 'gban.lua', 37 | 'users.lua', 38 | 'help.lua', 39 | 'rules.lua', 40 | 'settings.lua', 41 | 'about.lua', 42 | 'flag.lua', 43 | 'service.lua', 44 | 'links.lua', 45 | 'warn.lua', 46 | 'setlang.lua', 47 | 'floodmanager.lua', 48 | 'mediasettings.lua', 49 | 'private.lua', 50 | 'test.lua' 51 | }, 52 | plugins_opcionales = { 53 | "calculator.lua", 54 | "test.lua", 55 | "beta.lua", 56 | 'chatmodules.lua', 57 | 'faq.lua', 58 | 'caracola.lua', 59 | 'comprimirlink.lua', 60 | 'sendfiles.lua', 61 | 'killer.lua', 62 | 'say.lua', 63 | 'contact.lua', 64 | 'talk.lua', 65 | 'error.lua', 66 | 'saludador.lua', 67 | 'sera.lua', 68 | 'isbanned.lua', 69 | 'publi.lua', 70 | 'antigroserias.lua', 71 | 'antispam.lua', 72 | 'codes.lua', 73 | 'extra.lua' 74 | }, 75 | plugins_test = { 76 | 'gbanner.lua', 77 | 'inline.lua', 78 | 'plugin2.lua', 79 | }, 80 | --[[ plugins = { 81 | 'onmessage.lua', 82 | 'configure.lua', 83 | 'all.lua', 84 | 'admin.lua', 85 | 'banhammer.lua', 86 | 'users.lua', 87 | 'help.lua', 88 | 'rules.lua', 89 | 'settings.lua', 90 | 'about.lua', 91 | 'flag.lua', 92 | 'service.lua', 93 | 'links.lua', 94 | 'warn.lua', 95 | 'setlang.lua', 96 | 'floodmanager.lua', 97 | 'mediasettings.lua', 98 | 'private.lua', 99 | 'test.lua', 100 | 'faq.lua', 101 | 'caracola.lua', 102 | 'comprimirlink.lua', 103 | 'sendfiles.lua', 104 | 'killer.lua', 105 | 'say.lua', 106 | 'contact.lua', 107 | 'talk.lua', 108 | 'error.lua', 109 | 'saludador.lua', 110 | 'sera.lua', 111 | 'isbanned.lua', 112 | 'publi.lua', 113 | 'gbanner.lua', 114 | 'gban.lua', 115 | 'antigroserias.lua', 116 | 'antispam.lua', 117 | 'plugins.lua', 118 | 'plugin2.lua', 119 | 'inline.lua', 120 | "codes.lua", 121 | 'extra.lua' 122 | }, 123 | ]] 124 | multipurpose_plugins = { 125 | 'commit.lua', 126 | 'eightball.lua' 127 | }, 128 | available_languages = { 129 | 'es', 130 | --'it', 131 | 'en' 132 | --'br', 133 | --'ru', 134 | --'de', 135 | --'sv', 136 | --'ar', 137 | --'fr' 138 | --more to come 139 | }, 140 | media_list = { 141 | 'image', 142 | 'audio', 143 | 'video', 144 | 'sticker', 145 | 'gif', 146 | 'voice', 147 | 'contact', 148 | 'file', 149 | 'link' 150 | }, 151 | chat_settings = { 152 | ['settings'] = { 153 | ['Rules'] = 'no', 154 | ['About'] = 'no', 155 | ['Modlist'] = 'no', 156 | ['Report'] = 'no', 157 | ['Welcome'] = 'no', 158 | ['Extra'] = 'no', 159 | ['Flood'] = 'no' 160 | }, 161 | ['flood'] = { 162 | ['MaxFlood'] = 5, 163 | ['ActionFlood'] = 'kick' 164 | }, 165 | ['char'] = { 166 | ['Arab'] = 'allowed', 167 | ['Rtl'] = 'allowed' 168 | }, 169 | ['floodexceptions'] = { 170 | ['image'] = 'no', 171 | ['video'] = 'no', 172 | ['sticker'] = 'no', 173 | ['gif'] = 'no' 174 | }, 175 | ['warnsettings'] = { 176 | ['type'] = 'ban', 177 | ['max'] = 3, 178 | ['mediamax'] = 2 179 | }, 180 | ['welcome'] = { 181 | ['type'] = 'composed', 182 | ['content'] = 'no' 183 | }, 184 | ['media'] = { 185 | ['image'] = 'allowed', 186 | ['audio'] = 'allowed', 187 | ['video'] = 'allowed', 188 | ['sticker'] = 'allowed', 189 | ['gif'] = 'allowed', 190 | ['voice'] = 'allowed', 191 | ['contact'] = 'allowed', 192 | ['file'] = 'allowed', 193 | ['link'] = 'allowed', 194 | ['TGlink'] = 'allowed' 195 | }, 196 | }, 197 | chat_custom_texts = {'rules', 'about', 'extra'}, 198 | api_errors = { 199 | [101] = 'Not enough rights to kick participant', --SUPERGROUP: bot is not admin 200 | [102] = 'USER_ADMIN_INVALID', --SUPERGROUP: trying to kick an admin 201 | [103] = 'method is available for supergroup chats only', --NORMAL: trying to unban 202 | [104] = 'Only creator of the group can kick administrators from the group', --NORMAL: trying to kick an admin 203 | [105] = 'Bad Request: Need to be inviter of the user to kick it from the group', --NORMAL: bot is not an admin or everyone is an admin 204 | [106] = 'USER_NOT_PARTICIPANT', --NORMAL: trying to kick an user that is not in the group 205 | [107] = 'CHAT_ADMIN_REQUIRED', --NORMAL: bot is not an admin or everyone is an admin 206 | [108] = 'there is no administrators in the private chat', --something asked in a private chat with the api methods 2.1 207 | 208 | [110] = 'PEER_ID_INVALID', --user never started the bot 209 | [111] = 'message is not modified', --the edit message method hasn't modified the message 210 | [112] = 'Can\'t parse message text: Can\'t find end of the entity starting at byte offset %d+', --the markdown is wrong and breaks the delivery 211 | [113] = 'group chat is migrated to a supergroup chat', --group updated to supergroup 212 | [114] = 'Message can\'t be forwarded', --unknown 213 | [115] = 'Message text is empty', --empty message 214 | [116] = 'message not found', --message id invalid, I guess 215 | [117] = 'chat not found', --I don't know 216 | [118] = 'Message is too long', --over 4096 char 217 | [119] = 'User not found', --unknown user_id 218 | 219 | [120] = 'Can\'t parse reply keyboard markup JSON object', --keyboard table invalid 220 | [121] = 'Field \\\"inline_keyboard\\\" of the InlineKeyboardMarkup should be an Array of Arrays', --inline keyboard is not an array of array 221 | [122] = 'Can\'t parse inline keyboard button: InlineKeyboardButton should be an Object', 222 | [123] = 'Bad Request: Object expected as reply markup', --empty inline keyboard table 223 | [124] = 'QUERY_ID_INVALID', --callback query id invalid 224 | [125] = 'CHANNEL_PRIVATE', --I don't know 225 | [126] = 'MESSAGE_TOO_LONG', --text of an inline callback answer is too long 226 | [127] = 'wrong user_id specified', --invalid user_id 227 | [128] = 'Too big total timeout [%d%.]+', --something about spam an inline keyboards 228 | [129] = 'BUTTON_DATA_INVALID', --callback_data string invalid 229 | 230 | [130] = 'Type of file to send mismatch', --trying to send a media with the wrong method 231 | [131] = 'MESSAGE_ID_INVALID', --I don't know 232 | [132] = 'Can\'t parse inline keyboard button: Can\'t find field "text"', --the text of a button could be nil 233 | [133] = 'Can\'t parse inline keyboard button: Field \\\"text\\\" must be of type String', 234 | [134] = 'USER_ID_INVALID', 235 | [135] = 'CHAT_INVALID', 236 | 237 | [403] = 'Bot was blocked by the user', --user blocked the bot 238 | [429] = 'Too many requests: retry later', --the bot is hitting api limits 239 | [430] = 'Too big total timeout', --too many callback_data requests 240 | } 241 | } 242 | -------------------------------------------------------------------------------- /data/gbans: -------------------------------------------------------------------------------- 1 | 222445624, 2 | 225526344, 3 | 22747925, 4 | 228378643, 5 | 228824292, 6 | 236484869, 7 | 236829846, 8 | 237622676, 9 | 238664298, 10 | 238944256, 11 | 238948752, 12 | 239969267, 13 | 258963949, 14 | 27296972, 15 | 37884792, 16 | 45247445, 17 | 45499323, 18 | 47259483, 19 | 47287438, 20 | 4742352, 21 | 47887879, 22 | 53643993, 23 | 56443555, 24 | 57467424, 25 | 57685868, 26 | 59957487, 27 | 64328385, 28 | 64935586, 29 | 65227289, 30 | 65476882, 31 | 66344798, 32 | 66522846, 33 | 69465694, 34 | 72754466, 35 | 7335279, 36 | 75372362, 37 | 77284389, 38 | 78894994, 39 | 79532792, 40 | 82666849, 41 | 82843887, 42 | 83477797, 43 | 83695633, 44 | 84263278, 45 | 84355976, 46 | 84572932, 47 | 84593939, 48 | 84858782, 49 | 85375332, 50 | 86443828, 51 | 89847497, 52 | 92558785, 53 | 95738698, 54 | 98543968, 55 | 98885965, 56 | 187132213, 57 | 189748365, 58 | 71934576, 59 | 217529235, 60 | 124326722, 61 | 124885985, 62 | 126923475, 63 | 1036281, 64 | 1491862, 65 | 1873318, 66 | 2166074, 67 | 2696934, 68 | 3287205, 69 | 3423749, 70 | 3940053, 71 | 4141944, 72 | 4143540, 73 | 4201113, 74 | 4647150, 75 | 5563716, 76 | 5765516, 77 | 5809525, 78 | 6533305, 79 | 6719791, 80 | 6933616, 81 | 7383093, 82 | 7418245, 83 | 9824282, 84 | 10121096, 85 | 10207235, 86 | 11155251, 87 | 11544460, 88 | 11832353, 89 | 13603411, 90 | 13818043, 91 | 13818046, 92 | 13850876, 93 | 14695134, 94 | 15084291, 95 | 16570366, 96 | 16624802, 97 | 16905023, 98 | 18214643, 99 | 21927058, 100 | 22024375, 101 | 22922034, 102 | 24042469, 103 | 25076953, 104 | 26838207, 105 | 29836831, 106 | 30064193, 107 | 31325205, 108 | 32282540, 109 | 35520904, 110 | 37194141, 111 | 37951115, 112 | 38028245, 113 | 38248082, 114 | 38534939, 115 | 38615661, 116 | 41338609, 117 | 45250727, 118 | 45757839, 119 | 46402396, 120 | 47000928, 121 | 47168310, 122 | 47287438, 123 | 48431427, 124 | 49328415, 125 | 50308222, 126 | 53707572, 127 | 53831601, 128 | 55649559, 129 | 55809241, 130 | 56048779, 131 | 57467424, 132 | 57525704, 133 | 57562922, 134 | 59957487, 135 | 61258378, 136 | 61419380, 137 | 62224881, 138 | 62523311, 139 | 64044243, 140 | 64328385, 141 | 66344798, 142 | 66447784, 143 | 67415694, 144 | 68079298, 145 | 69396279, 146 | 69694039, 147 | 70800610, 148 | 71207116, 149 | 71444778, 150 | 71525302, 151 | 71744778, 152 | 71949585, 153 | 72135366, 154 | 72148046, 155 | 72754466, 156 | 74899728, 157 | 74957957, 158 | 75243051, 159 | 76072636, 160 | 76073636, 161 | 77057472, 162 | 77445130, 163 | 78796188, 164 | 78894994, 165 | 78903064, 166 | 79532792, 167 | 79572181, 168 | 80555888, 169 | 81075880, 170 | 81501528, 171 | 81847354, 172 | 81857656, 173 | 82043033, 174 | 82398154, 175 | 82456368, 176 | 83088306, 177 | 83392821, 178 | 83806303, 179 | 84263278, 180 | 84524841, 181 | 84910424, 182 | 84991111, 183 | 85659427, 184 | 85972680, 185 | 86081574, 186 | 86443828, 187 | 87834240, 188 | 88392672, 189 | 88775223, 190 | 88965696, 191 | 90248279, 192 | 90361374, 193 | 90505143, 194 | 90692327, 195 | 91701535, 196 | 91875812, 197 | 92149752, 198 | 93215469, 199 | 93275715, 200 | 93646145, 201 | 94013526, 202 | 94513873, 203 | 95384667, 204 | 95440324, 205 | 95701079, 206 | 95738698, 207 | 95929491, 208 | 96108099, 209 | 96686351, 210 | 97146789, 211 | 97720589, 212 | 97726218, 213 | 97909139, 214 | 97973103, 215 | 98034975, 216 | 99333763, 217 | 100450366, 218 | 100660706, 219 | 101193650, 220 | 101780886, 221 | 101829696, 222 | 101858987, 223 | 102072065, 224 | 102407623, 225 | 103628166, 226 | 103667104, 227 | 104294845, 228 | 104784211, 229 | 104810699, 230 | 105082436, 231 | 105283606, 232 | 105356078, 233 | 105427410, 234 | 105733905, 235 | 105831117, 236 | 106080135, 237 | 106102671, 238 | 107047923, 239 | 107090286, 240 | 107117297, 241 | 107408751, 242 | 107871510, 243 | 108483223, 244 | 108543364, 245 | 109883718, 246 | 110118287, 247 | 110226428, 248 | 110339707, 249 | 110462457, 250 | 110563763, 251 | 110568763, 252 | 110580092, 253 | 111402836, 254 | 111425793, 255 | 111539215, 256 | 111762332, 257 | 112208542, 258 | 112622834, 259 | 112775521, 260 | 113242988, 261 | 113463560, 262 | 113589486, 263 | 113942853, 264 | 114222150, 265 | 114289659, 266 | 114552601, 267 | 115181561, 268 | 115200165, 269 | 115366757, 270 | 115544251, 271 | 115609120, 272 | 115729936, 273 | 115756780, 274 | 116013457, 275 | 116073628, 276 | 116181561, 277 | 116301468, 278 | 116430704, 279 | 117125639, 280 | 117232864, 281 | 117408862, 282 | 117598170, 283 | 117694262, 284 | 117832187, 285 | 117852885, 286 | 117858746, 287 | 118232864, 288 | 118259322, 289 | 118524446, 290 | 118553886, 291 | 118801519, 292 | 118832187, 293 | 118853696, 294 | 118887271, 295 | 119336742, 296 | 119597036, 297 | 119962710, 298 | 120088521, 299 | 120194200, 300 | 120201309, 301 | 120355092, 302 | 120434722, 303 | 120636127, 304 | 120968995, 305 | 121315157, 306 | 121876002, 307 | 121913006, 308 | 122115548, 309 | 122189657, 310 | 122268254, 311 | 122478311, 312 | 122494027, 313 | 122591840, 314 | 122662162, 315 | 122703863, 316 | 124333114, 317 | 124449156, 318 | 124543002, 319 | 124602116, 320 | 124642545, 321 | 124874274, 322 | 124891697, 323 | 125012050, 324 | 125577403, 325 | 125669395, 326 | 125810343, 327 | 125871705, 328 | 126295590, 329 | 126909387, 330 | 126923475, 331 | 126993641, 332 | 127267914, 333 | 127517895, 334 | 128101268, 335 | 128393446, 336 | 128397301, 337 | 128777011, 338 | 128922342, 339 | 128948174, 340 | 128976419, 341 | 129138552, 342 | 129313721, 343 | 129389570, 344 | 129635068, 345 | 130121171, 346 | 130173874, 347 | 130463349, 348 | 130512548, 349 | 130779114, 350 | 131147126, 351 | 131210250, 352 | 131273155, 353 | 131273702, 354 | 131702134, 355 | 131734606, 356 | 132351872, 357 | 132749659, 358 | 132758281, 359 | 134018704, 360 | 134572539, 361 | 134613349, 362 | 134678243, 363 | 134711473, 364 | 134722641, 365 | 134903952, 366 | 135090084, 367 | 135161942, 368 | 135300053, 369 | 135927683, 370 | 136671254, 371 | 136817688, 372 | 136875257, 373 | 137185773, 374 | 137670308, 375 | 137830033, 376 | 137930033, 377 | 138439836, 378 | 138652794, 379 | 138952291, 380 | 139103784, 381 | 139193336, 382 | 139486740, 383 | 139768815, 384 | 139864636, 385 | 140175267, 386 | 141203019, 387 | 141798052, 388 | 142554282, 389 | 142805390, 390 | 143306124, 391 | 143314334, 392 | 143633432, 393 | 143787598, 394 | 144146616, 395 | 144295015, 396 | 144509853, 397 | 144573465, 398 | 145325574, 399 | 145385790, 400 | 145433128, 401 | 146338195, 402 | 146662486, 403 | 146793897, 404 | 146793898, 405 | 146951134, 406 | 147192273, 407 | 147203199, 408 | 147375982, 409 | 147451538, 410 | 147678663, 411 | 147908455, 412 | 148071490, 413 | 148422450, 414 | 148647952, 415 | 148683531, 416 | 149239072, 417 | 149394890, 418 | 149526860, 419 | 149991581, 420 | 150564073, 421 | 150834059, 422 | 151154811, 423 | 151388910, 424 | 151509381, 425 | 151645464, 426 | 151950500, 427 | 152046599, 428 | 152561399, 429 | 152596528, 430 | 153252356, 431 | 153374578, 432 | 153894041, 433 | 154127149, 434 | 154463311, 435 | 154510673, 436 | 154837927, 437 | 155463311, 438 | 155811608, 439 | 156230031, 440 | 156855216, 441 | 156907432, 442 | 157579028, 443 | 157702938, 444 | 157772137, 445 | 158042811, 446 | 158086653, 447 | 158216329, 448 | 158643974, 449 | 158776674, 450 | 159275750, 451 | 159364985, 452 | 159724780, 453 | 159783255, 454 | 159789976, 455 | 159947618, 456 | 159983672, 457 | 160101918, 458 | 160342183, 459 | 160657543, 460 | 160788622, 461 | 161053807, 462 | 161147817, 463 | 161728984, 464 | 161745952, 465 | 161754787, 466 | 161794454, 467 | 161795119, 468 | 161801854, 469 | 162206551, 470 | 162286512, 471 | 162307046, 472 | 162892709, 473 | 164536886, 474 | 164626424, 475 | 164734972, 476 | 164825513, 477 | 165378811, 478 | 165734817, 479 | 165738873, 480 | 165739873, 481 | 166531524, 482 | 166746222, 483 | 166757437, 484 | 166771635, 485 | 166851979, 486 | 166928979, 487 | 166987713, 488 | 168081824, 489 | 168642874, 490 | 168683981, 491 | 168828573, 492 | 169121597, 493 | 169149523, 494 | 169320497, 495 | 169431441, 496 | 169928311, 497 | 170165273, 498 | 170897029, 499 | 171191342, 500 | 171388155, 501 | 171615674, 502 | 172401693, 503 | 172619482, 504 | 173003568, 505 | 173360594, 506 | 173475782, 507 | 174066300, 508 | 174081201, 509 | 174240867, 510 | 174328096, 511 | 174717133, 512 | 174909465, 513 | 175160134, 514 | 175624559, 515 | 175840159, 516 | 175996891, 517 | 176276150, 518 | 176444952, 519 | 176821396, 520 | 176832015, 521 | 176840538, 522 | 176932067, 523 | 177145244, 524 | 177775568, 525 | 177841845, 526 | 177866896, 527 | 177915635, 528 | 178381348, 529 | 178761202, 530 | 179033998, 531 | 179292104, 532 | 179542244, 533 | 179689646, 534 | 179982517, 535 | 183945669, 536 | 186382824, 537 | 194306213, 538 | 255801020, 539 | 646440004, 540 | 646440041, 541 | 710155516, 542 | 723364050, 543 | 1003960972, 544 | 142752502, 545 | 127295630, 546 | 176149208, 547 | 12732841, 548 | 197531890, 549 | 174480238, 550 | 142231513, 551 | 128010905, 552 | 145165951, 553 | 118489708, 554 | 197724672, 555 | 182589073, 556 | 11448535, 557 | 133902265, 558 | 185231788, 559 | 143579462, 560 | 210352928, 561 | 166442181, 562 | 196498731, 563 | 145793897, 564 | 11809182, 565 | 172296873, 566 | 197821105, 567 | 151516285, 568 | 163058536, 569 | 50959873, 570 | 78779667, 571 | 197947905, 572 | 208556480, 573 | 124442861, 574 | 218094936, 575 | 166514878, 576 | 163248439, 577 | 165801720, 578 | 55197070, 579 | 4411103, 580 | 89847497, 581 | 187857915, 582 | 143646607, 583 | 194017675, 584 | 115172094, 585 | 206671924, 586 | 187660603, 587 | 187792851, 588 | 83477797, 589 | 103460563, 590 | 37931335, 591 | 7307987, 592 | 41801776, 593 | 82039419, 594 | 91723142, 595 | 97986042, 596 | 106952004, 597 | 170320624, 598 | 95311150, 599 | 148353020, 600 | 136519198, 601 | 150155374, 602 | 92558785, 603 | 81530763, 604 | 178856781, 605 | 178566309, 606 | 71662049, 607 | 58308342, 608 | 146834517, 609 | 172767635, 610 | 164340906, 611 | 127039864, 612 | 165913691, 613 | 91054649, 614 | 151590904, 615 | 67018895, 616 | 166904913, 617 | 118682430, 618 | 81578020, 619 | 109328427, 620 | 181240822, 621 | 137395630, 622 | 58197455, 623 | 86056011, 624 | 182161005, 625 | 199512626, 626 | 116410047, 627 | 219857278, 628 | 210256118, 629 | 140728516, 630 | 148571409, 631 | 153367927, 632 | 137542932, 633 | 147904555, 634 | 218226665, 635 | 128945619, 636 | 89427023, 637 | 141795341, 638 | 216619611, 639 | 14089301, 640 | 140803881, 641 | 166361224, 642 | 23510662, 643 | 161002093, 644 | 180541590, 645 | 84593939, 646 | 214502112, 647 | 197677966, 648 | 69465694, 649 | 190824452, 650 | 156083900, 651 | 113195330, 652 | 128188125, 653 | 135975051, 654 | 215398453, 655 | 53025236, 656 | 65476882, 657 | 180249792, 658 | 199346309, 659 | 170630045, 660 | 150591376, 661 | 172914369, 662 | 154541428, 663 | 9206411, 664 | 165156330, 665 | 156603389, 666 | 165326094, 667 | 90761744, 668 | 134549846, 669 | 1031093150, 670 | 138000057, 671 | 146591117, 672 | 99253801, 673 | 116650069, 674 | 150621658, 675 | 79196745, 676 | 159391497, 677 | 95355713, 678 | 191533532, 679 | 112214776, 680 | 20772388, 681 | 188021610, 682 | 189221402, 683 | 177287023, 684 | 90337686, 685 | 108589208, 686 | 135421102, 687 | 142531707, 688 | 163327115, 689 | 158038447, 690 | 184494191, 691 | 98712722, 692 | 153304477, 693 | 55405720, 694 | 194751571, 695 | 114983637, 696 | 196499937, 697 | 161159097, 698 | 89419285, 699 | 34538808, 700 | 95196070, 701 | 169742831, 702 | 24299034, 703 | 86791726, 704 | 137354143, 705 | 155811307, 706 | 148110218, 707 | 148179815, 708 | 162326402, 709 | 32224700, 710 | 184719168, 711 | 195357500, 712 | 139994345, 713 | 194321911, 714 | 130179736, 715 | 175466950, 716 | 118559452, 717 | 65227289, 718 | 70496338, 719 | 1007842071, 720 | 78571860, 721 | 160426699, 722 | 212811361, 723 | 180975911, 724 | 219521053, 725 | 106373820, 726 | 210543836, 727 | 175169134, 728 | 146925005, 729 | 219335776, 730 | 45247445, 731 | 61103053, 732 | 40671325, 733 | 188001184, 734 | 11936169, 735 | 134515368, 736 | 128532137, 737 | 195303113, 738 | 196433207, 739 | 154981969, 740 | 153144382, 741 | 151726433, 742 | 101658544, 743 | 82843887, 744 | 190433951, 745 | 166578526, 746 | 129471706, 747 | 173867391, 748 | 97206824, 749 | 195831710, 750 | 84029038, 751 | 169895146, 752 | 102600785, 753 | 152453598, 754 | 214080808, 755 | 82666849, 756 | 212045983, 757 | 102650034, 758 | 134237543, 759 | 182857990, 760 | 217055468, 761 | 198449267, 762 | 152681210, 763 | 179398038, 764 | 138899659, 765 | 167386568, 766 | 191017860, 767 | 178431201, 768 | 132905535, 769 | 190598337, 770 | 183413502, 771 | 157312181, 772 | 203394494, 773 | 188594093, 774 | 117573964, 775 | 191136980, 776 | 180727364, 777 | 105922399, 778 | 167060309, 779 | 152355735, 780 | 128802892, 781 | 218709580, 782 | 215407629, 783 | 190292825, 784 | 226195686, 785 | 238116356, 786 | 222722107, 787 | 1057666087, 788 | 1066938736, 789 | 176557879, 790 | 12736682, 791 | 236699550, 792 | 93157246, 793 | 138596778, 794 | 226403420, 795 | 185583409, 796 | 185818816, 797 | 165581490, 798 | 124047454, 799 | -------------------------------------------------------------------------------- /data/key: -------------------------------------------------------------------------------- 1 | readapikey -------------------------------------------------------------------------------- /data/spam: -------------------------------------------------------------------------------- 1 | https://telegram.me/ -------------------------------------------------------------------------------- /enviar/archivo/avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ridrogo/ModeradorBot/91f3c660f6baa9ea4152718572b1596d01096c10/enviar/archivo/avatar.jpg -------------------------------------------------------------------------------- /enviar/archivo/putty.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ridrogo/ModeradorBot/91f3c660f6baa9ea4152718572b1596d01096c10/enviar/archivo/putty.exe -------------------------------------------------------------------------------- /enviar/gif/giphy.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ridrogo/ModeradorBot/91f3c660f6baa9ea4152718572b1596d01096c10/enviar/gif/giphy.mp4 -------------------------------------------------------------------------------- /enviar/gif/prueba.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ridrogo/ModeradorBot/91f3c660f6baa9ea4152718572b1596d01096c10/enviar/gif/prueba.gif -------------------------------------------------------------------------------- /enviar/imagen/avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ridrogo/ModeradorBot/91f3c660f6baa9ea4152718572b1596d01096c10/enviar/imagen/avatar.jpg -------------------------------------------------------------------------------- /enviar/imagen/instructions.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ridrogo/ModeradorBot/91f3c660f6baa9ea4152718572b1596d01096c10/enviar/imagen/instructions.jpg -------------------------------------------------------------------------------- /enviar/video/troll.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ridrogo/ModeradorBot/91f3c660f6baa9ea4152718572b1596d01096c10/enviar/video/troll.mp4 -------------------------------------------------------------------------------- /gbanner/decoder.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | throw() { 4 | echo "$*" >&2 5 | exit 1 6 | } 7 | 8 | BRIEF=0 9 | LEAFONLY=0 10 | PRUNE=0 11 | NO_HEAD=0 12 | NORMALIZE_SOLIDUS=0 13 | 14 | usage() { 15 | echo 16 | echo "Usage: JSON.sh [-b] [-l] [-p] [-s] [-h]" 17 | echo 18 | echo "-p - Prune empty. Exclude fields with empty values." 19 | echo "-l - Leaf only. Only show leaf nodes, which stops data duplication." 20 | echo "-b - Brief. Combines 'Leaf only' and 'Prune empty' options." 21 | echo "-n - No-head. Do not show nodes that have no path (lines that start with [])." 22 | echo "-s - Remove escaping of the solidus symbol (stright slash)." 23 | echo "-h - This help text." 24 | echo 25 | } 26 | 27 | parse_options() { 28 | set -- "$@" 29 | local ARGN=$# 30 | while [ "$ARGN" -ne 0 ] 31 | do 32 | case $1 in 33 | -h) usage 34 | exit 0 35 | ;; 36 | -b) BRIEF=1 37 | LEAFONLY=1 38 | PRUNE=1 39 | ;; 40 | -l) LEAFONLY=1 41 | ;; 42 | -p) PRUNE=1 43 | ;; 44 | -n) NO_HEAD=1 45 | ;; 46 | -s) NORMALIZE_SOLIDUS=1 47 | ;; 48 | ?*) echo "ERROR: Unknown option." 49 | usage 50 | exit 0 51 | ;; 52 | esac 53 | shift 1 54 | ARGN=$((ARGN-1)) 55 | done 56 | } 57 | 58 | awk_egrep () { 59 | local pattern_string=$1 60 | 61 | gawk '{ 62 | while ($0) { 63 | start=match($0, pattern); 64 | token=substr($0, start, RLENGTH); 65 | print token; 66 | $0=substr($0, start+RLENGTH); 67 | } 68 | }' pattern="$pattern_string" 69 | } 70 | 71 | tokenize () { 72 | local GREP 73 | local ESCAPE 74 | local CHAR 75 | 76 | if echo "test string" | egrep -ao --color=never "test" >/dev/null 2>&1 77 | then 78 | GREP='egrep -ao --color=never' 79 | else 80 | GREP='egrep -ao' 81 | fi 82 | 83 | if echo "test string" | egrep -o "test" >/dev/null 2>&1 84 | then 85 | ESCAPE='(\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})' 86 | CHAR='[^[:cntrl:]"\\]' 87 | else 88 | GREP=awk_egrep 89 | ESCAPE='(\\\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})' 90 | CHAR='[^[:cntrl:]"\\\\]' 91 | fi 92 | 93 | local STRING="\"$CHAR*($ESCAPE$CHAR*)*\"" 94 | local NUMBER='-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?' 95 | local KEYWORD='null|false|true' 96 | local SPACE='[[:space:]]+' 97 | 98 | # Force zsh to expand $A into multiple words 99 | local is_wordsplit_disabled=$(unsetopt 2>/dev/null | grep -c '^shwordsplit$') 100 | if [ $is_wordsplit_disabled != 0 ]; then setopt shwordsplit; fi 101 | $GREP "$STRING|$NUMBER|$KEYWORD|$SPACE|." | egrep -v "^$SPACE$" 102 | if [ $is_wordsplit_disabled != 0 ]; then unsetopt shwordsplit; fi 103 | } 104 | 105 | parse_array () { 106 | local index=0 107 | local ary='' 108 | read -r token 109 | case "$token" in 110 | ']') ;; 111 | *) 112 | while : 113 | do 114 | parse_value "$1" "$index" 115 | index=$((index+1)) 116 | ary="$ary""$value" 117 | read -r token 118 | case "$token" in 119 | ']') break ;; 120 | ',') ary="$ary," ;; 121 | *) throw "EXPECTED , or ] GOT ${token:-EOF}" ;; 122 | esac 123 | read -r token 124 | done 125 | ;; 126 | esac 127 | [ "$BRIEF" -eq 0 ] && value=$(printf '[%s]' "$ary") || value= 128 | : 129 | } 130 | 131 | parse_object () { 132 | local key 133 | local obj='' 134 | read -r token 135 | case "$token" in 136 | '}') ;; 137 | *) 138 | while : 139 | do 140 | case "$token" in 141 | '"'*'"') key=$token ;; 142 | *) throw "EXPECTED string GOT ${token:-EOF}" ;; 143 | esac 144 | read -r token 145 | case "$token" in 146 | ':') ;; 147 | *) throw "EXPECTED : GOT ${token:-EOF}" ;; 148 | esac 149 | read -r token 150 | parse_value "$1" "$key" 151 | obj="$obj$key:$value" 152 | read -r token 153 | case "$token" in 154 | '}') break ;; 155 | ',') obj="$obj," ;; 156 | *) throw "EXPECTED , or } GOT ${token:-EOF}" ;; 157 | esac 158 | read -r token 159 | done 160 | ;; 161 | esac 162 | [ "$BRIEF" -eq 0 ] && value=$(printf '{%s}' "$obj") || value= 163 | : 164 | } 165 | 166 | parse_value () { 167 | local jpath="${1:+$1,}$2" isleaf=0 isempty=0 print=0 168 | case "$token" in 169 | '{') parse_object "$jpath" ;; 170 | '[') parse_array "$jpath" ;; 171 | # At this point, the only valid single-character tokens are digits. 172 | ''|[!0-9]) throw "EXPECTED value GOT ${token:-EOF}" ;; 173 | *) value=$token 174 | # if asked, replace solidus ("\/") in json strings with normalized value: "/" 175 | [ "$NORMALIZE_SOLIDUS" -eq 1 ] && value=$(echo "$value" | sed 's#\\/#/#g') 176 | isleaf=1 177 | [ "$value" = '""' ] && isempty=1 178 | ;; 179 | esac 180 | [ "$value" = '' ] && return 181 | [ "$NO_HEAD" -eq 1 ] && [ -z "$jpath" ] && return 182 | 183 | [ "$LEAFONLY" -eq 0 ] && [ "$PRUNE" -eq 0 ] && print=1 184 | [ "$LEAFONLY" -eq 1 ] && [ "$isleaf" -eq 1 ] && [ $PRUNE -eq 0 ] && print=1 185 | [ "$LEAFONLY" -eq 0 ] && [ "$PRUNE" -eq 1 ] && [ "$isempty" -eq 0 ] && print=1 186 | [ "$LEAFONLY" -eq 1 ] && [ "$isleaf" -eq 1 ] && \ 187 | [ $PRUNE -eq 1 ] && [ $isempty -eq 0 ] && print=1 188 | [ "$print" -eq 1 ] && printf "[%s]\t%s\n" "$jpath" "$value" 189 | : 190 | } 191 | 192 | parse () { 193 | read -r token 194 | parse_value 195 | read -r token 196 | case "$token" in 197 | '') ;; 198 | *) throw "EXPECTED EOF GOT $token" ;; 199 | esac 200 | } 201 | 202 | if ([ "$0" = "$BASH_SOURCE" ] || ! [ -n "$BASH_SOURCE" ]); 203 | then 204 | parse_options "$@" 205 | tokenize | parse 206 | fi 207 | 208 | # vi: expandtab sw=2 ts=2 209 | -------------------------------------------------------------------------------- /gbanner/metodo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #*.*encoding=utf-7*.* 3 | 4 | TOKEN=$(cat ./data/key) 5 | GBANS=$(cat ./data/gbans) 6 | 7 | API='https://api.telegram.org/bot'$TOKEN 8 | ACCION=$API'/kickChatMember' 9 | getUpdates=$API'/getUpdates?offset=' 10 | 11 | banear_miembro() { 12 | cURL=$(curl -s "$ACCION" -F "chat_id=$1" -F "user_id=$2") 13 | } 14 | 15 | process_client() { 16 | 17 | # User 18 | user_id=$(echo "$cURL" | egrep '\["result",0,"message","from","id"\]' | cut -f 2) 19 | chat_id=$(echo "$cURL" | egrep '\["result",0,"message","chat","id"\]' | cut -f 2) 20 | new_chat_member=$(echo "$cURL" | egrep '\["result",0,"message","new_chat_member","id"\]' | cut -f 2) 21 | 22 | # Read list of gbans 23 | echo $GBANS | grep $user_id &>/dev/null 24 | if [ $? == 0 ]; then 25 | GBAN=1 26 | else 27 | if [ ! -z "$new_chat_member" ]; then 28 | echo $GBANS | grep $new_chat_member 29 | if [ $? == 0 ]; then 30 | GBAN=1 31 | fi 32 | fi 33 | GBAN=0 34 | fi 35 | 36 | 37 | if [ $GBAN == 1 ]; then 38 | banear_miembro "$chat_id" "${GBAN}" 39 | banear_miembro "$chat_id" "$user_id" 40 | banear_miembro "$chat_id" "$new_chat_member" 41 | fi 42 | 43 | } 44 | 45 | while [ "$1" == "gbans" ]; do { 46 | 47 | cURL=$(curl -s $getUpdates | ./gbanner/decoder.sh -s) 48 | 49 | if [ "$2" == "test" ]; then 50 | process_client 51 | else 52 | process_client& 53 | fi 54 | }; done -------------------------------------------------------------------------------- /gbanner/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "JSON.sh", 3 | "version": "0.3.2", 4 | "description": "JSON parser written in shell", 5 | "homepage": "http://github.com/dominictarr/JSON.sh", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/dominictarr/JSON.sh.git" 9 | }, 10 | "bin": { 11 | "JSON.sh": "./JSON.sh" 12 | }, 13 | "dependencies": {}, 14 | "devDependencies": {}, 15 | "author": "Dominic Tarr (http://bit.ly/dominictarr)", 16 | "scripts": { 17 | "test": "./all-tests.sh" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /gbans.lua: -------------------------------------------------------------------------------- 1 | do local _ = { 2 | gbans_users = { 3 | 1036281, 4 | 1491862, 5 | 1873318, 6 | 2166074, 7 | 2696934, 8 | 3287205, 9 | 3423749, 10 | 3940053, 11 | 4141944, 12 | 4143540, 13 | 4201113, 14 | 4647150, 15 | 5563716, 16 | 5765516, 17 | 5809525, 18 | 6533305, 19 | 6719791, 20 | 6933616, 21 | 7383093, 22 | 7418245, 23 | 9824282, 24 | 10121096, 25 | 10207235, 26 | 11155251, 27 | 11544460, 28 | 11832353, 29 | 13603411, 30 | 13818043, 31 | 13818046, 32 | 13850876, 33 | 14695134, 34 | 15084291, 35 | 16570366, 36 | 16624802, 37 | 16905023, 38 | 18214643, 39 | 21927058, 40 | 22024375, 41 | 22922034, 42 | 24042469, 43 | 25076953, 44 | 26838207, 45 | 29836831, 46 | 30064193, 47 | 31325205, 48 | 32282540, 49 | 35520904, 50 | 37194141, 51 | 37951115, 52 | 38028245, 53 | 38248082, 54 | 38534939, 55 | 38615661, 56 | 40123115, 57 | 41338609, 58 | 45250727, 59 | 45757839, 60 | 46402396, 61 | 47000928, 62 | 47168310, 63 | 47287438, 64 | 48431427, 65 | 49328415, 66 | 50308222, 67 | 53707572, 68 | 53831601, 69 | 55649559, 70 | 55809241, 71 | 56048779, 72 | 57467424, 73 | 57525704, 74 | 57562922, 75 | 59957487, 76 | 61258378, 77 | 61419380, 78 | 62224881, 79 | 62523311, 80 | 64044243, 81 | 64328385, 82 | 66344798, 83 | 66447784, 84 | 67415694, 85 | 68079298, 86 | 69396279, 87 | 69694039, 88 | 70800610, 89 | 71207116, 90 | 71444778, 91 | 71525302, 92 | 71744778, 93 | 71949585, 94 | 72135366, 95 | 72148046, 96 | 72754466, 97 | 74899728, 98 | 74957957, 99 | 75243051, 100 | 76072636, 101 | 76073636, 102 | 77057472, 103 | 77445130, 104 | 78796188, 105 | 78894994, 106 | 78903064, 107 | 79532792, 108 | 79572181, 109 | 80555888, 110 | 81075880, 111 | 81501528, 112 | 81847354, 113 | 81857656, 114 | 82043033, 115 | 82398154, 116 | 82456368, 117 | 83088306, 118 | 83392821, 119 | 83806303, 120 | 84263278, 121 | 84524841, 122 | 84910424, 123 | 84991111, 124 | 85659427, 125 | 85972680, 126 | 86081574, 127 | 86443828, 128 | 87834240, 129 | 88392672, 130 | 88775223, 131 | 88965696, 132 | 90248279, 133 | 90361374, 134 | 90505143, 135 | 90692327, 136 | 91701535, 137 | 91875812, 138 | 92149752, 139 | 93215469, 140 | 93275715, 141 | 93646145, 142 | 94013526, 143 | 94513873, 144 | 95384667, 145 | 95440324, 146 | 95701079, 147 | 95738698, 148 | 95929491, 149 | 96108099, 150 | 96686351, 151 | 97146789, 152 | 97720589, 153 | 97726218, 154 | 97909139, 155 | 97973103, 156 | 98034975, 157 | 99333763, 158 | 100450366, 159 | 100660706, 160 | 101193650, 161 | 101780886, 162 | 101829696, 163 | 101858987, 164 | 102072065, 165 | 102407623, 166 | 103628166, 167 | 103667104, 168 | 104294845, 169 | 104784211, 170 | 104810699, 171 | 105082436, 172 | 105283606, 173 | 105356078, 174 | 105427410, 175 | 105733905, 176 | 105831117, 177 | 106080135, 178 | 106102671, 179 | 107047923, 180 | 107090286, 181 | 107117297, 182 | 107408751, 183 | 107871510, 184 | 108483223, 185 | 108543364, 186 | 109883718, 187 | 110118287, 188 | 110226428, 189 | 110339707, 190 | 110462457, 191 | 110563763, 192 | 110568763, 193 | 110580092, 194 | 111402836, 195 | 111425793, 196 | 111539215, 197 | 111762332, 198 | 112208542, 199 | 112622834, 200 | 112775521, 201 | 113242988, 202 | 113463560, 203 | 113589486, 204 | 113942853, 205 | 114222150, 206 | 114289659, 207 | 114552601, 208 | 115181561, 209 | 115200165, 210 | 115366757, 211 | 115544251, 212 | 115609120, 213 | 115729936, 214 | 115756780, 215 | 116013457, 216 | 116073628, 217 | 116181561, 218 | 116301468, 219 | 116430704, 220 | 117125639, 221 | 117232864, 222 | 117408862, 223 | 117598170, 224 | 117694262, 225 | 117832187, 226 | 117852885, 227 | 117858746, 228 | 118232864, 229 | 118259322, 230 | 118524446, 231 | 118553886, 232 | 118801519, 233 | 118832187, 234 | 118853696, 235 | 118887271, 236 | 119336742, 237 | 119597036, 238 | 119962710, 239 | 120088521, 240 | 120194200, 241 | 120201309, 242 | 120355092, 243 | 120434722, 244 | 120636127, 245 | 120968995, 246 | 121315157, 247 | 121876002, 248 | 121913006, 249 | 122115548, 250 | 122189657, 251 | 122268254, 252 | 122478311, 253 | 122494027, 254 | 122591840, 255 | 122662162, 256 | 122703863, 257 | 123231962, 258 | 123289212, 259 | 123678723, 260 | 123679337, 261 | 124333114, 262 | 124449156, 263 | 124543002, 264 | 124602116, 265 | 124642545, 266 | 124874274, 267 | 124891697, 268 | 125012050, 269 | 125577403, 270 | 125669395, 271 | 125810343, 272 | 125871705, 273 | 126295590, 274 | 126909387, 275 | 126923475, 276 | 126993641, 277 | 127267914, 278 | 127517895, 279 | 128031123, 280 | 128101268, 281 | 128393446, 282 | 128397301, 283 | 128777011, 284 | 128922342, 285 | 128931123, 286 | 128948174, 287 | 128976419, 288 | 129138552, 289 | 129313721, 290 | 129389570, 291 | 129635068, 292 | 130121171, 293 | 130173874, 294 | 130463349, 295 | 130512548, 296 | 130779114, 297 | 131147126, 298 | 131210250, 299 | 131273155, 300 | 131273702, 301 | 131702134, 302 | 131734606, 303 | 132351872, 304 | 132749659, 305 | 132758281, 306 | 134018704, 307 | 134572539, 308 | 134613349, 309 | 134678243, 310 | 134711473, 311 | 134722641, 312 | 134903952, 313 | 135090084, 314 | 135161942, 315 | 135300053, 316 | 135927683, 317 | 136671254, 318 | 136817688, 319 | 136875257, 320 | 137185773, 321 | 137670308, 322 | 137830033, 323 | 137930033, 324 | 138439836, 325 | 138652794, 326 | 138952291, 327 | 139103784, 328 | 139193336, 329 | 139486740, 330 | 139768815, 331 | 139864636, 332 | 140175267, 333 | 141203019, 334 | 141798052, 335 | 142554282, 336 | 142805390, 337 | 143306124, 338 | 143314334, 339 | 143633432, 340 | 143787598, 341 | 144146616, 342 | 144295015, 343 | 144509853, 344 | 144573465, 345 | 145325574, 346 | 145385790, 347 | 145433128, 348 | 146338195, 349 | 146412353, 350 | 146662486, 351 | 146793897, 352 | 146793898, 353 | 146951134, 354 | 147192273, 355 | 147203199, 356 | 147375982, 357 | 147451538, 358 | 147678663, 359 | 147908455, 360 | 148071490, 361 | 148422450, 362 | 148647952, 363 | 148683531, 364 | 149239072, 365 | 149394890, 366 | 149526860, 367 | 149991581, 368 | 150564073, 369 | 150834059, 370 | 151154811, 371 | 151388910, 372 | 151509381, 373 | 151645464, 374 | 151950500, 375 | 152046599, 376 | 152561399, 377 | 152596528, 378 | 153252356, 379 | 153374578, 380 | 153894041, 381 | 154127149, 382 | 154463311, 383 | 154510673, 384 | 154837927, 385 | 155463311, 386 | 155811608, 387 | 156230031, 388 | 156855216, 389 | 156907432, 390 | 157579028, 391 | 157702938, 392 | 157772137, 393 | 158042811, 394 | 158086653, 395 | 158216329, 396 | 158643974, 397 | 158776674, 398 | 159275750, 399 | 159364985, 400 | 159724780, 401 | 159783255, 402 | 159789976, 403 | 159947618, 404 | 159983672, 405 | 160101918, 406 | 160342183, 407 | 160657543, 408 | 160788622, 409 | 161053807, 410 | 161147817, 411 | 161728984, 412 | 161745952, 413 | 161754787, 414 | 161794454, 415 | 161795119, 416 | 161801854, 417 | 162206551, 418 | 162286512, 419 | 162307046, 420 | 162892709, 421 | 164536886, 422 | 164626424, 423 | 164734972, 424 | 164825513, 425 | 165378811, 426 | 165734817, 427 | 165738873, 428 | 165739873, 429 | 166531524, 430 | 166746222, 431 | 166757437, 432 | 166771635, 433 | 166851979, 434 | 166928979, 435 | 166987713, 436 | 168081824, 437 | 168642874, 438 | 168683981, 439 | 168828573, 440 | 169121597, 441 | 169149523, 442 | 169320497, 443 | 169431441, 444 | 169928311, 445 | 170165273, 446 | 170897029, 447 | 171191342, 448 | 171388155, 449 | 171615674, 450 | 172401693, 451 | 172619482, 452 | 173003568, 453 | 173360594, 454 | 173475782, 455 | 174066300, 456 | 174081201, 457 | 174240867, 458 | 174328096, 459 | 174717133, 460 | 174909465, 461 | 175160134, 462 | 175624559, 463 | 175840159, 464 | 175996891, 465 | 176276150, 466 | 176444952, 467 | 176821396, 468 | 176832015, 469 | 176840538, 470 | 176932067, 471 | 177145244, 472 | 177775568, 473 | 177841845, 474 | 177866896, 475 | 177915635, 476 | 178381348, 477 | 178761202, 478 | 179033998, 479 | 179292104, 480 | 179542244, 481 | 179689646, 482 | 179982517, 483 | 183945669, 484 | 186382824, 485 | 194306213, 486 | 255801020, 487 | 646440004, 488 | 646440041, 489 | 710155516, 490 | 723364050, 491 | 1003960972, 492 | 142752502, 493 | 127295630, 494 | 176149208, 495 | 12732841, 496 | 197531890, 497 | 174480238, 498 | 142231513, 499 | 128010905, 500 | 145165951, 501 | 118489708, 502 | 197724672, 503 | 182589073, 504 | 11448535, 505 | 133902265, 506 | 185231788, 507 | 143579462, 508 | 210352928, 509 | 166442181, 510 | 196498731, 511 | 145793897, 512 | 11809182, 513 | 172296873, 514 | 197821105, 515 | 151516285, 516 | 163058536, 517 | 50959873, 518 | 78779667, 519 | 197947905, 520 | 208556480, 521 | 124442861, 522 | 218094936, 523 | 166514878, 524 | 163248439, 525 | 165801720, 526 | 55197070, 527 | 4411103, 528 | 89847497, 529 | 187857915, 530 | 143646607, 531 | 194017675, 532 | 115172094, 533 | 206671924, 534 | 187660603, 535 | 187792851, 536 | 83477797, 537 | 103460563, 538 | 37931335, 539 | 7307987, 540 | 41801776, 541 | 82039419, 542 | 91723142, 543 | 97986042, 544 | 106952004, 545 | 170320624, 546 | 95311150, 547 | 123791833, 548 | 148353020, 549 | 136519198, 550 | 150155374, 551 | 92558785, 552 | 81530763, 553 | 178856781, 554 | 178566309, 555 | 71662049, 556 | 58308342, 557 | 146834517, 558 | 172767635, 559 | 164340906, 560 | 127039864, 561 | 165913691, 562 | 91054649, 563 | 151590904, 564 | 67018895, 565 | 166904913, 566 | 118682430, 567 | 81578020, 568 | 109328427, 569 | 181240822, 570 | 137395630, 571 | 58197455, 572 | 86056011, 573 | 182161005, 574 | 199512626, 575 | 116410047, 576 | 219857278, 577 | 210256118, 578 | 140728516, 579 | 148571409, 580 | 153367927, 581 | 137542932, 582 | 147904555, 583 | 218226665, 584 | 128945619, 585 | 89427023, 586 | 141795341, 587 | 216619611, 588 | 14089301, 589 | 140803881, 590 | 166361224, 591 | 23510662, 592 | 161002093, 593 | 180541590, 594 | 84593939, 595 | 214502112, 596 | 197677966, 597 | 69465694, 598 | 190824452, 599 | 156083900, 600 | 113195330, 601 | 128188125, 602 | 135975051, 603 | 215398453, 604 | 53025236, 605 | 65476882, 606 | 180249792, 607 | 199346309, 608 | 170630045, 609 | 150591376, 610 | 172914369, 611 | 154541428, 612 | 9206411, 613 | 165156330, 614 | 156603389, 615 | 165326094, 616 | 90761744, 617 | 134549846, 618 | 1031093150, 619 | 138000057, 620 | 146591117, 621 | 99253801, 622 | 116650069, 623 | 150621658, 624 | 79196745, 625 | 159391497, 626 | 95355713, 627 | 123625994, 628 | 191533532, 629 | 112214776, 630 | 20772388, 631 | 188021610, 632 | 189221402, 633 | 177287023, 634 | 90337686, 635 | 108589208, 636 | 135421102, 637 | 142531707, 638 | 163327115, 639 | 158038447, 640 | 184494191, 641 | 98712722, 642 | 153304477, 643 | 55405720, 644 | 194751571, 645 | 114983637, 646 | 196499937, 647 | 161159097, 648 | 89419285, 649 | 34538808, 650 | 95196070, 651 | 169742831, 652 | 24299034, 653 | 86791726, 654 | 137354143, 655 | 155811307, 656 | 148110218, 657 | 148179815, 658 | 162326402, 659 | 32224700, 660 | 184719168, 661 | 195357500, 662 | 139994345, 663 | 194321911, 664 | 130179736, 665 | 175466950, 666 | 118559452, 667 | 65227289, 668 | 70496338, 669 | 1007842071, 670 | 78571860, 671 | 160426699, 672 | 212811361, 673 | 180975911, 674 | 219521053, 675 | 106373820, 676 | 210543836, 677 | 175169134, 678 | 146925005, 679 | 219335776, 680 | 45247445, 681 | 61103053, 682 | 40671325, 683 | 188001184, 684 | 11936169, 685 | 134515368, 686 | 128532137, 687 | 195303113, 688 | 196433207, 689 | 154981969, 690 | 153144382, 691 | 151726433, 692 | 101658544, 693 | 82843887, 694 | 190433951, 695 | 166578526, 696 | 129471706, 697 | 173867391, 698 | 97206824, 699 | 195831710, 700 | 84029038, 701 | 169895146, 702 | 102600785, 703 | 152453598, 704 | 214080808, 705 | 82666849, 706 | 212045983, 707 | 102650034, 708 | 134237543, 709 | 182857990, 710 | 217055468, 711 | 198449267, 712 | 152681210, 713 | 179398038, 714 | 138899659, 715 | 167386568, 716 | 191017860, 717 | 178431201, 718 | 132905535, 719 | 190598337, 720 | 183413502, 721 | 157312181, 722 | 203394494, 723 | 188594093, 724 | 117573964, 725 | 191136980, 726 | 180727364, 727 | 105922399, 728 | 167060309, 729 | 152355735, 730 | 128802892, 731 | 218709580, 732 | 215407629, 733 | 190292825, 734 | 226195686, 735 | 238116356, 736 | 222722107, 737 | 1057666087, 738 | 1066938736, 739 | 176557879, 740 | 12736682, 741 | 236699550, 742 | 93157246, 743 | 138596778, 744 | 226403420, 745 | 185583409, 746 | 185818816, 747 | 165581490, 748 | 124047454, 749 | 217529235 750 | } 751 | } 752 | return _ 753 | end -------------------------------------------------------------------------------- /org.telegram.plus-3.10.1.0.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ridrogo/ModeradorBot/91f3c660f6baa9ea4152718572b1596d01096c10/org.telegram.plus-3.10.1.0.apk -------------------------------------------------------------------------------- /plugins/about.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks, ln) 2 | --ignore if via pm 3 | if msg.chat.type == 'private' then 4 | return 5 | end 6 | 7 | local hash = 'chat:'..msg.chat.id..':about' 8 | if blocks[1] == 'about' then 9 | local out = cross.getAbout(msg.chat.id, ln) 10 | if is_locked(msg, 'About') and not is_mod(msg) then 11 | api.sendMessage(msg.from.id, out, true) 12 | else 13 | api.sendReply(msg, out, true) 14 | end 15 | end 16 | 17 | if not is_mod(msg) then 18 | return 19 | end 20 | 21 | if blocks[1] == 'addabout' then 22 | if not blocks[2] then 23 | api.sendReply(msg, lang[ln].setabout.no_input_add) 24 | return 25 | end 26 | --load about 27 | about = db:get(hash) 28 | --check if there is an about text 29 | if not about then 30 | api.sendReply(msg, lang[ln].setabout.no_bio_add, true) 31 | else 32 | local input = blocks[2] 33 | --add the new string to the about text 34 | local res = api.sendReply(msg, make_text(lang[ln].setabout.added, input), true) 35 | if not res then 36 | api.sendReply(msg, lang[ln].breaks_markdown, true) 37 | else 38 | about = about..'\n'..input 39 | db:set(hash, about) 40 | end 41 | end 42 | end 43 | if blocks[1] == 'setabout' then 44 | local input = blocks[2] 45 | --ignore if not mod 46 | 47 | --ignore if not text 48 | if not input then 49 | api.sendReply(msg, lang[ln].setabout.no_input_set, true) 50 | return 51 | end 52 | --check if the mod want to clean the about text 53 | if input == 'clean' then 54 | db:del(hash) 55 | api.sendReply(msg, lang[ln].setabout.clean) 56 | return 57 | end 58 | 59 | --set the new about 60 | local res, code = api.sendReply(msg, make_text(lang[ln].setabout.new, input), true) 61 | if not res then 62 | if code == 118 then 63 | api.sendMessage(msg.chat.id, lang[ln].bonus.too_long) 64 | else 65 | api.sendMessage(msg.chat.id, lang[ln].breaks_markdown, true) 66 | end 67 | else 68 | db:set(hash, input) 69 | local id = res.result.message_id 70 | api.editMessageText(msg.chat.id, id, lang[ln].setabout.about_setted, false, true) 71 | end 72 | end 73 | 74 | end 75 | 76 | return { 77 | action = action, 78 | get_about = get_about, 79 | triggers = { 80 | '^/(setabout)$', --to warn if an user don't add a text 81 | '^/(setabout) (.*)', 82 | '^/(about)$', 83 | '^/(addabout)$', --to warn if an user don't add a text 84 | '^/(addabout) (.*)', 85 | } 86 | } -------------------------------------------------------------------------------- /plugins/all.lua: -------------------------------------------------------------------------------- 1 | local included_fields = { 2 | 'settings', 3 | 'about', 4 | 'rules', 5 | 'mod', 6 | 'extra' 7 | } 8 | 9 | local function changeWarnSettings(chat_id, action, ln) 10 | local current = tonumber(db:hget('chat:'..chat_id..':warnsettings', 'max')) or 3 11 | local new_val 12 | if action == 1 then 13 | if current > 12 then 14 | return lang[ln].warn.inline_high 15 | else 16 | new_val = db:hincrby('chat:'..chat_id..':warnsettings', 'max', 1) 17 | return current..'->'..new_val 18 | end 19 | elseif action == -1 then 20 | if current < 2 then 21 | return lang[ln].warn.inline_low 22 | else 23 | new_val = db:hincrby('chat:'..chat_id..':warnsettings', 'max', -1) 24 | return current..'->'..new_val 25 | end 26 | elseif action == 'status' then 27 | local status = (db:hget('chat:'..chat_id..':warnsettings', 'type')) or 'kick' 28 | if status == 'kick' then 29 | db:hset('chat:'..chat_id..':warnsettings', 'type', 'ban') 30 | return make_text(lang[ln].warn.changed_type, 'ban') 31 | elseif status == 'ban' then 32 | db:hset('chat:'..chat_id..':warnsettings', 'type', 'kick') 33 | return make_text(lang[ln].warn.changed_type, 'kick') 34 | end 35 | end 36 | end 37 | 38 | local function changeCharSettings(chat_id, field, ln) 39 | local hash = 'chat:'..chat_id..':char' 40 | local status = db:hget(hash, field) 41 | local text 42 | if status == 'allowed' then 43 | db:hset(hash, field, 'kick') 44 | text = lang[ln].settings.char[field:lower()..'_kick'] 45 | elseif status == 'kick' then 46 | db:hset(hash, field, 'ban') 47 | text = lang[ln].settings.char[field:lower()..'_ban'] 48 | elseif status == 'ban' then 49 | db:hset(hash, field, 'allowed') 50 | text = lang[ln].settings.char[field:lower()..'_allow'] 51 | else 52 | db:hset(hash, field, 'allowed') 53 | text = lang[ln].settings.char[field:lower()..'_allow'] 54 | end 55 | 56 | return text 57 | end 58 | 59 | local function getWelcomeMessage(chat_id, ln) 60 | hash = 'chat:'..chat_id..':welcome' 61 | local type = db:hget(hash, 'type') 62 | local message = '' 63 | if type == 'composed' then 64 | local wel = db:hget(hash, 'content') 65 | if wel == 'a' then 66 | message = message..lang[ln].settings.resume.w_a 67 | elseif wel == 'r' then 68 | message = message..lang[ln].settings.resume.w_r 69 | elseif wel == 'm' then 70 | message = message..lang[ln].settings.resume.w_m 71 | elseif wel == 'ra' then 72 | message = message..lang[ln].settings.resume.w_ra 73 | elseif wel == 'rm' then 74 | message = message..lang[ln].settings.resume.w_rm 75 | elseif wel == 'am' then 76 | message = message..lang[ln].settings.resume.w_am 77 | elseif wel == 'ram' then 78 | message = message..lang[ln].settings.resume.w_ram 79 | elseif wel == 'no' then 80 | message = message..lang[ln].settings.resume.w_no 81 | end 82 | elseif type == 'media' then 83 | message = message..lang[ln].settings.resume.w_media 84 | elseif type == 'custom' then 85 | message = db:hget(hash, 'content') 86 | end 87 | return message 88 | end 89 | 90 | local function getFloodSettings_text(chat_id, ln) 91 | local status = db:hget('chat:'..chat_id..':settings', 'Flood') or 'yes' --check (default: disabled) 92 | if status == 'no' then 93 | status = '✅ | ON' 94 | elseif status == 'yes' then 95 | status = '❌ | OFF' 96 | end 97 | local hash = 'chat:'..chat_id..':flood' 98 | local action = (db:hget(hash, 'ActionFlood')) or 'kick' 99 | if action == 'kick' then 100 | action = '⚡️ '..action 101 | else 102 | action = '⛔ ️'..action 103 | end 104 | local num = (db:hget(hash, 'MaxFlood')) or 5 105 | local exceptions = { 106 | ['text'] = lang[ln].floodmanager.text, 107 | ['sticker'] = lang[ln].floodmanager.sticker, 108 | ['image'] = lang[ln].floodmanager.image, 109 | ['gif'] = lang[ln].floodmanager.gif, 110 | ['video'] = lang[ln].floodmanager.video 111 | } 112 | hash = 'chat:'..chat_id..':floodexceptions' 113 | local list_exc = '' 114 | for media, translation in pairs(exceptions) do 115 | --ignored by the antiflood-> yes, no 116 | local exc_status = (db:hget(hash, media)) or 'no' 117 | if exc_status == 'yes' then 118 | exc_status = '✅' 119 | else 120 | exc_status = '❌' 121 | end 122 | list_exc = list_exc..'• `'..translation..'`: '..exc_status..'\n' 123 | end 124 | return make_text(lang[ln].all.dashboard.antiflood, status, action, num, list_exc) 125 | end 126 | 127 | local function doKeyboard_dashboard(chat_id, ln) 128 | local keyboard = {} 129 | keyboard.inline_keyboard = { 130 | { 131 | {text = lang[ln].all.dashboard.settings, callback_data = 'dashboard:settings:'..chat_id}, 132 | {text = lang[ln].all.dashboard.admins, callback_data = 'dashboard:modlist:'..chat_id} 133 | }, 134 | { 135 | {text = lang[ln].all.dashboard.rules, callback_data = 'dashboard:rules:'..chat_id}, 136 | {text = lang[ln].all.dashboard.about, callback_data = 'dashboard:about:'..chat_id} 137 | }, 138 | { 139 | {text = lang[ln].all.dashboard.welcome, callback_data = 'dashboard:welcome:'..chat_id}, 140 | {text = lang[ln].all.dashboard.extra, callback_data = 'dashboard:extra:'..chat_id} 141 | }, 142 | { 143 | {text = lang[ln].all.dashboard.flood, callback_data = 'dashboard:flood:'..chat_id}, 144 | {text = lang[ln].all.dashboard.media, callback_data = 'dashboard:media:'..chat_id} 145 | }, 146 | } 147 | 148 | return keyboard 149 | end 150 | 151 | local function usersettings_table(settings) 152 | local return_table = {} 153 | local icon_yes, icon_no = '👤', '👥' 154 | for field, status in pairs(settings) do 155 | if field == 'Modlist' or field == 'About' or field == 'Rules' or field == 'Extra' then 156 | if status == 'yes' then 157 | return_table[field] = icon_yes 158 | elseif status == 'no' then 159 | return_table[field] = icon_no 160 | end 161 | end 162 | end 163 | 164 | return return_table 165 | end 166 | 167 | local function adminsettings_table(settings) 168 | local return_table = {} 169 | local icon_yes, icon_no = '🚫', '✅' 170 | for field, status in pairs(settings) do 171 | if field == 'Flood' or field == 'Report' or field == 'Welcome' or field == 'Admin_mode' then 172 | if status == 'yes' then 173 | return_table[field] = icon_yes 174 | elseif status == 'no' then 175 | return_table[field] = icon_no 176 | end 177 | end 178 | end 179 | 180 | return return_table 181 | end 182 | 183 | local function charsettings_table(chat_id) 184 | local settings = db:hgetall('chat:'..chat_id..':char') 185 | local return_table = {} 186 | local icon_allow, icon_not_allow = '✅', '🔐' 187 | for field, status in pairs(settings) do 188 | if status == 'kick' or status == 'ban' then 189 | return_table[field] = icon_not_allow..' '..status 190 | elseif status == 'allowed' then 191 | return_table[field] = icon_allow 192 | end 193 | end 194 | 195 | return return_table 196 | end 197 | 198 | local function insert_settings_section(keyboard, settings_section, chat_id, ln) 199 | for key, icon in pairs(settings_section) do 200 | local current = { 201 | {text = lang[ln].settings[key], callback_data = 'menu:alert:settings'}, 202 | {text = icon, callback_data = 'menu:'..key..':'..chat_id} 203 | } 204 | table.insert(keyboard.inline_keyboard, current) 205 | end 206 | 207 | return keyboard 208 | end 209 | 210 | local function doKeyboard_menu(chat_id, ln) 211 | local keyboard = {inline_keyboard = {}} 212 | 213 | --settings 214 | local settings = db:hgetall('chat:'..chat_id..':settings') 215 | 216 | local settings_section = adminsettings_table(settings) 217 | keyboard = insert_settings_section(keyboard, settings_section, chat_id, ln) 218 | 219 | settings_section = usersettings_table(settings) 220 | keyboard = insert_settings_section(keyboard, settings_section, chat_id, ln) 221 | 222 | settings_section = charsettings_table(chat_id) 223 | keyboard = insert_settings_section(keyboard, settings_section, chat_id, ln) 224 | 225 | --warn 226 | local max = (db:hget('chat:'..chat_id..':warnsettings', 'max')) or 3 227 | action = (db:hget('chat:'..chat_id..':warnsettings', 'type')) or 'kick' 228 | local warn = { 229 | {text = '➖', callback_data = 'menu:DimWarn:'..chat_id}, 230 | {text = '📍'..max..' 🔨️'..action, callback_data = 'menu:ActionWarn:'..chat_id}, 231 | {text = '➕', callback_data = 'menu:RaiseWarn:'..chat_id}, 232 | } 233 | table.insert(keyboard.inline_keyboard, {{text = 'Warns 👇🏼', callback_data = 'menu:alert:warns:'}}) 234 | table.insert(keyboard.inline_keyboard, warn) 235 | 236 | return keyboard 237 | end 238 | 239 | local function get_group_name(text) 240 | local name = text:match('.*%((.+)%)$') 241 | if not name then 242 | return '' 243 | end 244 | name = '\n('..name..')' 245 | return name:mEscape() 246 | end 247 | 248 | local action = function(msg, blocks, ln) 249 | 250 | --get the interested chat id 251 | local chat_id, msg_id 252 | if msg.cb then 253 | chat_id = msg.data:gsub('[%a _]+:', '') 254 | msg_id = msg.message_id 255 | else 256 | chat_id = msg.chat.id 257 | end 258 | 259 | local keyboard = {} 260 | 261 | if blocks[1] == 'dashboard' then 262 | if not(msg.chat.type == 'private') and not msg.cb then 263 | keyboard = doKeyboard_dashboard(chat_id, ln) 264 | --everyone can use this 265 | local res = api.sendKeyboard(msg.from.id, lang[ln].all.dashboard.first, keyboard, true) 266 | if res then 267 | api.sendMessage(msg.chat.id, lang[ln].all.dashboard.private, true) 268 | else 269 | cross.sendStartMe(msg, ln) 270 | end 271 | return 272 | end 273 | if msg.cb then 274 | local request = blocks[2] 275 | local text 276 | keyboard = doKeyboard_dashboard(chat_id, ln) 277 | if request == 'settings' then 278 | text = cross.getSettings(chat_id, ln) 279 | end 280 | if request == 'rules' then 281 | text = cross.getRules(chat_id, ln) 282 | end 283 | if request == 'about' then 284 | text = cross.getAbout(chat_id, ln) 285 | end 286 | if request == 'modlist' then 287 | local creator, admins = cross.getModlist(chat_id) 288 | if not creator then 289 | text = lang[ln].bonus.adminlist_admin_required --creator is false, admins is the error code 290 | else 291 | text = make_text(lang[ln].mod.modlist, creator, admins) 292 | end 293 | end 294 | if request == 'extra' then 295 | text = cross.getExtraList(chat_id, ln) 296 | end 297 | if request == 'welcome' then 298 | text = getWelcomeMessage(chat_id, ln) 299 | end 300 | if request == 'flood' then 301 | text = getFloodSettings_text(chat_id, ln) 302 | end 303 | if request == 'media' then 304 | text = lang[ln].mediasettings.settings_header 305 | for i, media in pairs(config.media_list) do 306 | local status = (db:hget('chat:'..chat_id..':media', media)) or 'allowed' 307 | if status == 'allowed' then 308 | status = '✅' 309 | else 310 | status = '🔐 '..status 311 | end 312 | text = text..'`'..media..'` ≡ '..status..'\n' 313 | end 314 | end 315 | api.editMessageText(msg.chat.id, msg_id, text, keyboard, true) 316 | api.answerCallbackQuery(msg.cb_id, 'ℹ️ Group ► '..request) 317 | return 318 | end 319 | end 320 | if blocks[1] == 'menu' then 321 | if not(msg.chat.type == 'private') and not msg.cb then 322 | if not is_mod(msg) then return end --only mods can use this 323 | keyboard = doKeyboard_menu(chat_id, ln) 324 | local res = api.sendKeyboard(msg.from.id, lang[ln].all.menu_first..'\n('..msg.chat.title:mEscape()..')', keyboard, true) 325 | if res then 326 | api.sendMessage(msg.chat.id, lang[ln].all.menu, true) 327 | else 328 | cross.sendStartMe(msg, ln) 329 | end 330 | return 331 | end 332 | if msg.cb then 333 | local text 334 | if blocks[2] == 'alert' then 335 | if blocks[3] == 'settings' then 336 | text = '⚠️ '..lang[ln].bonus.menu_cb_settings 337 | elseif blocks[3] == 'warns' then 338 | text = '⚠️ '..lang[ln].bonus.menu_cb_warns 339 | end 340 | api.answerCallbackQuery(msg.cb_id, text) 341 | return 342 | end 343 | if blocks[2] == 'DimWarn' or blocks[2] == 'RaiseWarn' or blocks[2] == 'ActionWarn' then 344 | if blocks[2] == 'DimWarn' then 345 | text = changeWarnSettings(chat_id, -1, ln) 346 | elseif blocks[2] == 'RaiseWarn' then 347 | text = changeWarnSettings(chat_id, 1, ln) 348 | elseif blocks[2] == 'ActionWarn' then 349 | text = changeWarnSettings(chat_id, 'status', ln) 350 | end 351 | elseif blocks[2] == 'Rtl' or blocks[2] == 'Arab' then 352 | text = changeCharSettings(chat_id, blocks[2], ln) 353 | else 354 | text = cross.changeSettingStatus(chat_id, blocks[2], ln) 355 | end 356 | keyboard = doKeyboard_menu(chat_id, ln) 357 | local group_name = get_group_name(msg.old_text) 358 | api.editMessageText(msg.chat.id, msg_id, lang[ln].all.menu_first..group_name, keyboard, true) 359 | if text then api.answerCallbackQuery(msg.cb_id, '⚙ '..text) end --workaround to avoid to send an error to users who are using an old inline keyboard 360 | end 361 | end 362 | end 363 | 364 | return { 365 | action = action, 366 | triggers = { 367 | '^/(dashboard)$', 368 | '^/(menu)$', 369 | 370 | '^###cb:(dashboard):(%a+):(-%d+)', 371 | 372 | '^###cb:(menu):(alert):(settings)', 373 | '^###cb:(menu):(alert):(warns)', 374 | 375 | '^###cb:(menu):(.*):', 376 | } 377 | } 378 | -------------------------------------------------------------------------------- /plugins/antigroserias.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks, ln) 2 | 3 | if not (msg.chat.type == 'private') and is_mod(msg) then return end 4 | 5 | if db:hget('chat:'..msg.chat.id..':settings', 'groseria') == 'disable' then 6 | local iduser = msg.from.id 7 | local name = msg.from.first_name 8 | if msg.from.username then name = name..' (@'..msg.from.username..')' end 9 | math.randomseed( os.time() ); 10 | var = math.random(0,4); math.random(0,4); math.random(0,4); 11 | if var == 0 then 12 | api.sendMessage(msg.chat.id, 'Hey *' ..name.. '* ID '..iduser..', Cuida tu lenguaje o serás expulsado', true) 13 | elseif var == 1 then 14 | api.sendMessage(msg.chat.id, 'Recuerda *' ..name.. '* ID '..iduser..', no usar un mal lenguaje aquí, o serás expulsado/a', true) 15 | elseif var == 2 then 16 | api.sendMessage(msg.chat.id, 'Lo siento, *' ..name.. '*, ID '..iduser..', expulsado/a por grosero/a', true) 17 | api.kickUser(msg.chat.id, msg.from.id) 18 | elseif var == 3 then 19 | api.sendMessage(msg.chat.id, '*' ..name.. '* ID '..iduser..', si sigues enviando malas palabras serás baneado/a definitivamente', true) 20 | elseif var == 4 then 21 | api.sendMessage(msg.chat.id, 'Lo siento *' ..name.. '*, ID '..iduser..', baneado/a por grosero/a.', true) 22 | api.kickChatMember(msg.chat.id, msg.from.id) 23 | end 24 | end 25 | end 26 | return { 27 | action = action, 28 | triggers = { 29 | "[Pp][Uu][Tt](.*)", 30 | "[Mm][Ii][Ee][Rr][Dd][Aa]", 31 | "[Pp][Ee][Rr][Rr](.*)", 32 | "[Gg][Aa][Yy]", 33 | "[Pp][Aa][Rr][Ii][Dd](.*)", 34 | "[Ff][Uu][Cc][Kk]", 35 | "[Ss][Hh][Ii][Tt]" 36 | -- "[Cc][Hh][Aa][Nn][Nn][Ee][Ll](.*)@(.*)" 37 | } 38 | } -------------------------------------------------------------------------------- /plugins/antispam.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks, ln) 2 | 3 | if not(msg.chat.type == 'private') and not is_mod(msg) then 4 | 5 | if db:hget('chat:'..msg.chat.id..':settings', 'spam') == 'disable' then 6 | local iduser = msg.from.id 7 | local name = msg.from.first_name 8 | if msg.from.username then name = name..' (@'..msg.from.username..')' end 9 | math.randomseed(os.time()); 10 | var = math.random(0,4); 11 | if var == 0 then 12 | api.sendMessage(msg.chat.id, 'Hey *' ..name.. '* ID '..iduser..', No envies enlaces de otros grupos o serás expulsado', true) 13 | elseif var == 1 then 14 | api.sendMessage(msg.chat.id, 'Recuerda *' ..name.. '* ID '..iduser..', si envias enlaces de otros grupos serás expulsado', true) 15 | elseif var == 2 then 16 | api.sendMessage(msg.chat.id, 'Lo siento, *' ..name.. '*, ID '..iduser..', expulsado por spammer', true) 17 | api.kickUser(msg.chat.id, msg.from.id) 18 | elseif var == 3 then 19 | api.sendMessage(msg.chat.id, '*' ..name.. '* ID '..iduser..', si sigues enviando spam serás baneado definitivamente', true) 20 | elseif var == 4 then 21 | api.sendMessage(msg.chat.id, 'Lo siento *' ..name.. '*, ID '..iduser..', baneado por spammer.', true) 22 | api.kickChatMember(msg.chat.id, msg.from.id) 23 | end 24 | end 25 | end 26 | end 27 | 28 | return { 29 | action = action, 30 | triggers = { 31 | "[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm]%.[Mm][Ee](.*)", 32 | "[Cc][Aa][Nn][Aa][Ll](.*)@(.*)", 33 | "[Cc][Hh][Aa][Nn][Nn][Ee][Ll](.*)@(.*)" 34 | } 35 | } -------------------------------------------------------------------------------- /plugins/banhammer.lua: -------------------------------------------------------------------------------- 1 | local function cron() 2 | local all = db:hgetall('tempbanned') 3 | if next(all) then 4 | for unban_time,info in pairs(all) do 5 | if os.time() > tonumber(unban_time) then 6 | local chat_id, user_id = info:match('(-%d+):(%d+)') 7 | api.unbanUser(chat_id, user_id, true) 8 | api.unbanUser(chat_id, user_id, false) 9 | db:hdel('tempbanned', unban_time) 10 | db:srem('chat:'..chat_id..':tempbanned', user_id) --hash needed to check if an user is already tempbanned or not 11 | end 12 | end 13 | end 14 | end 15 | 16 | local function get_user_id(msg, blocks) 17 | if msg.cb then 18 | return blocks[2] 19 | elseif msg.reply then 20 | return msg.reply.from.id 21 | elseif blocks[2] then 22 | return res_user_group(blocks[2], msg.chat.id) 23 | end 24 | end 25 | 26 | local function get_nick(msg, blocks, sender) 27 | if sender then 28 | return getname_id(msg) 29 | elseif msg.reply then 30 | return getname_id(msg.reply) 31 | elseif blocks[2] then 32 | return blocks[2] 33 | end 34 | end 35 | 36 | local function getBanList(chat_id, ln) 37 | local text = lang[ln].banhammer.banlist_header 38 | local hash = 'chat:'..chat_id..':bannedlist' 39 | local banned_users, mot = rdb.get(hash) 40 | if not banned_users or not next(banned_users) then 41 | return lang[ln].banhammer.banlist_empty, true 42 | else 43 | local i = 1 44 | for banned_id,info in pairs(banned_users) do 45 | text = text..'*'..i..'* - '..info.nick:mEscape() 46 | if info.why then text = text..'\n*⌦* '..info.why:mEscape() end 47 | text = text..'\n' 48 | i = i + 1 49 | end 50 | return text 51 | end 52 | end 53 | 54 | local function check_valid_time(temp) 55 | temp = tonumber(temp) 56 | if temp == 0 then 57 | return false, 1 58 | elseif temp > 10080 then --1 week 59 | return false, 2 60 | else 61 | return temp 62 | end 63 | end 64 | 65 | local function get_time_reply(minutes) 66 | local time_string = '' 67 | local time_table = {} 68 | time_table.days = math.floor(minutes/(60*24)) 69 | minutes = minutes - (time_table.days*60*24) 70 | time_table.hours = math.floor(minutes/60) 71 | time_table.minutes = minutes % 60 72 | if not(time_table.days == 0) then 73 | time_string = time_table.days..'d' 74 | end 75 | if not(time_table.hours == 0) then 76 | time_string = time_string..' '..time_table.hours..'h' 77 | end 78 | time_string = time_string..' '..time_table.minutes..'m' 79 | return time_string, time_table 80 | end 81 | 82 | local action = function(msg, blocks, ln) 83 | if msg.chat.type ~= 'private' then 84 | if is_mod(msg) then 85 | --commands that don't need a target user 86 | if blocks[1] == 'kickme' then 87 | api.sendReply(msg, lang[ln].kick_errors[2], true) 88 | return 89 | end 90 | if blocks[1] == 'banlist' and not blocks[2] then 91 | local banlist, is_empty = getBanList(msg.chat.id, ln) 92 | if is_empty then 93 | api.sendReply(msg, banlist, true) 94 | else 95 | api.sendKeyboard(msg.chat.id, banlist, {inline_keyboard={{{text = 'Clean', callback_data = 'banlist-'}}}}, true) 96 | end 97 | return 98 | end 99 | if blocks[1] == 'banlist' and blocks[2] and blocks[2] == '-' then 100 | local res, error = rdb.rem('chat:'..msg.chat.id..':bannedlist') 101 | if res then 102 | if msg.cb then --if cleaned via the inline button 103 | api.editMessageText(msg.chat.id, msg.message_id, lang[ln].banhammer.banlist_cleaned..'\n`(Admin: '..msg.from.first_name:mEscape()..')`', false, true) 104 | else --if cleaned via message 105 | api.sendReply(msg, lang[ln].banhammer.banlist_cleaned, true) 106 | end 107 | else 108 | local text 109 | --get thetext 110 | if error:match('hash does not exists') then 111 | text = lang[ln].banhammer.banlist_empty 112 | else 113 | text = lang[ln].banhammer.banlist_error 114 | end 115 | --reply or edit 116 | if msg.cb then 117 | api.editMessageText(msg.chat.id, msg.message_id, text, false, true) 118 | else 119 | api.sendReply(msg, text, true) 120 | end 121 | end 122 | return 123 | end 124 | 125 | --commands that need a target user 126 | 127 | if not msg.reply_to_message and not blocks[2] and not msg.cb then 128 | api.sendReply(msg, lang[ln].banhammer.reply) 129 | return 130 | end 131 | if msg.reply and msg.reply.from.id == bot.id then return end 132 | 133 | local res 134 | local chat_id = msg.chat.id 135 | 136 | if blocks[1] == 'tempban' then 137 | if not msg.reply then 138 | api.sendReply(msg, lang[ln].banhammer.reply) 139 | return 140 | end 141 | local user_id = msg.reply.from.id 142 | local temp, code = check_valid_time(blocks[2]) 143 | if not temp then 144 | if code == 1 then 145 | api.sendReply(msg, lang[ln].banhammer.tempban_zero) 146 | else 147 | api.sendReply(msg, lang[ln].banhammer.tempban_week) 148 | end 149 | return 150 | end 151 | local val = msg.chat.id..':'..user_id 152 | local unban_time = os.time() + (temp * 60) 153 | 154 | --try to kick 155 | local res, motivation = api.banUser(chat_id, user_id, is_normal_group, ln) 156 | if not res then 157 | if not motivation then 158 | motivation = lang[ln].banhammer.general_motivation 159 | end 160 | api.sendReply(msg, motivation, true) 161 | else 162 | cross.saveBan(user_id, 'tempban') --save the ban 163 | db:hset('tempbanned', unban_time, val) --set the hash 164 | local time_reply = get_time_reply(temp) 165 | local banned_name = getname(msg.reply) 166 | local is_already_tempbanned = db:sismember('chat:'..chat_id..':tempbanned', user_id) --hash needed to check if an user is already tempbanned or not 167 | if is_already_tempbanned then 168 | api.sendMessage(chat_id, make_text(lang[ln].banhammer.tempban_updated..time_reply, banned_name)) 169 | else 170 | api.sendMessage(chat_id, make_text(lang[ln].banhammer.tempban_banned..time_reply, banned_name)) 171 | db:sadd('chat:'..chat_id..':tempbanned', user_id) --hash needed to check if an user is already tempbanned or not 172 | end 173 | end 174 | end 175 | 176 | --get the user id, send message and break if not found 177 | local user_id = get_user_id(msg, blocks) 178 | if not user_id then 179 | api.sendReply(msg, lang[ln].bonus.no_user, true) 180 | return 181 | end 182 | 183 | if blocks[1] == 'kick' then 184 | local res, motivation = api.kickUser(chat_id, user_id, ln) 185 | if not res then 186 | if not motivation then 187 | motivation = lang[ln].banhammer.general_motivation 188 | end 189 | api.sendReply(msg, motivation, true) 190 | else 191 | cross.saveBan(user_id, 'kick') 192 | api.sendMessage(msg.chat.id, lang[ln].banhammer.kicked:build_text(get_nick(msg, false, true):mEscape(), get_nick(msg, blocks):mEscape()), true) 193 | end 194 | end 195 | 196 | local is_normal_group = false 197 | if msg.chat.type == 'group' then is_normal_group = true end 198 | 199 | if blocks[1] == 'ban' then 200 | local res, motivation = api.banUser(chat_id, user_id, is_normal_group, ln) 201 | if not res then 202 | if not motivation then 203 | motivation = lang[ln].banhammer.general_motivation 204 | end 205 | api.sendReply(msg, motivation, true) 206 | else 207 | --save the ban 208 | cross.saveBan(user_id, 'ban') 209 | --add to banlist 210 | local nick = get_nick(msg, blocks) --banned user 211 | local why 212 | if msg.reply then 213 | why = msg.text:input() 214 | else 215 | why = msg.text:gsub('^/ban @[%w_]+%s?', '') 216 | end 217 | cross.addBanList(msg.chat.id, user_id, nick, why) 218 | api.sendKeyboard(msg.chat.id, lang[ln].banhammer.banned:build_text(get_nick(msg, false, true):mEscape(), nick:mEscape()), {inline_keyboard = {{{text = 'Unban', callback_data = 'unban:'..user_id}}}}, true) 219 | end 220 | end 221 | if blocks[1] == 'unban' then 222 | local status = cross.getUserStatus(chat_id, user_id) 223 | if not(status == 'kicked') and not(msg.chat.type == 'group') then 224 | api.sendReply(msg, lang[ln].banhammer.not_banned, true) 225 | return 226 | end 227 | local res = api.unbanUser(chat_id, user_id, is_normal_group) 228 | local text 229 | if not res and msg.chat.type == 'group' then 230 | --api.sendReply(msg, lang[ln].banhammer.not_banned, true) 231 | text = lang[ln].banhammer.not_banned 232 | else 233 | cross.remBanList(msg.chat.id, user_id) 234 | text = lang[ln].banhammer.unbanned 235 | --api.sendReply(msg, lang[ln].banhammer.unbanned, true) 236 | end 237 | if not msg.cb then 238 | api.sendReply(msg, text, true) 239 | else 240 | api.editMessageText(msg.chat.id, msg.message_id, text..'\n`['..user_id..']\n(Admin: '..msg.from.first_name:mEscape()..')`', false, true) 241 | end 242 | end 243 | else 244 | if blocks[1] == 'kickme' then 245 | api.kickUser(msg.chat.id, msg.from.id, ln) 246 | end 247 | if msg.cb then --if the user tap on 'unban', show the pop-up 248 | api.answerCallbackQuery(msg.cb_id, lang[ln].not_mod:mEscape_hard()) 249 | end 250 | end 251 | end 252 | end 253 | 254 | return { 255 | action = action, 256 | cron = cron, 257 | triggers = { 258 | '^/(kickme)%s?', 259 | '^/(kick) (@[%w_]+)', 260 | '^/(kick)', 261 | '^/(banlist)$', 262 | '^/(banlist) (-)$', 263 | '^/(ban) (@[%w_]+)', 264 | '^/(ban)', 265 | '^/(tempban) (%d+)', 266 | '^/(unban) (@[%w_]+)', 267 | '^/(unban)', 268 | '^###cb:(unban):(%d+)$', 269 | '^###cb:(banlist)(-)$', 270 | } 271 | } -------------------------------------------------------------------------------- /plugins/beta.lua: -------------------------------------------------------------------------------- 1 | local triggers = { 2 | '^/(beta)$' 3 | } 4 | 5 | local action = function(msg, blocks, ln) 6 | 7 | if blocks[1] == 'beta' then 8 | username = msg.from.username 9 | api.sendDocument(msg.from.id, './org.telegram.plus-3.10.1.0.apk') 10 | api.sendMessage(msg.chat.id, 'Te enviaré la versión beta última de Plus Messenger en un minuto por privado.\n*Verifica el privado del bot* :)\n\nBeta enviada a: @' ..username, true) 11 | end 12 | end 13 | 14 | return { 15 | action = action, 16 | triggers = triggers 17 | } 18 | -------------------------------------------------------------------------------- /plugins/calculator.lua: -------------------------------------------------------------------------------- 1 | local function expr(msg, blocks) 2 | local do_entry = blocks[1] 3 | local result = "expr "..do_entry 4 | local final_result = result:gsub('+', ' + '):gsub('*', ' \\* '):gsub('/', ' / '):gsub('-', ' - ') 5 | local action = io.popen(final_result) 6 | local read = action:read("*a") 7 | return read 8 | end 9 | 10 | local action = function(msg, blocks) 11 | local do_expr = expr(msg, blocks) 12 | 13 | api.sendReply(msg, '*Resultado* _'..do_expr..'_', true) 14 | 15 | end 16 | 17 | 18 | return { 19 | information = "Plugin calc by @Jarriz to QuickBot", 20 | action = action, 21 | triggers = { 22 | '^/calc (.+)$', 23 | } 24 | } -------------------------------------------------------------------------------- /plugins/caracola.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks, ln) 2 | 3 | if blocks[1] == 'caracolamagica' or blocks[1] == 'caracola' and blocks[2] then 4 | math.randomseed(os.time()); 5 | end 6 | num = math.random(0,3); 7 | if num == 0 then 8 | api.sendSticker(msg.chat.id, './caracola/si.webp') 9 | elseif num == 1 then 10 | api.sendSticker(msg.chat.id, './caracola/no.webp') 11 | elseif num == 2 then 12 | api.sendSticker(msg.chat.id, './caracola/probablemente.webp') 13 | elseif num == 3 then 14 | api.sendSticker(msg.chat.id, './caracola/nocreo.webp') 15 | end 16 | end 17 | 18 | 19 | return { 20 | action = action, 21 | triggers = { 22 | '/[Cc]aracolamagica (.*)', 23 | '/[Cc]aracola (.*)' 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/chatmodules.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks, ln) 2 | 3 | if not (msg.chat.type == 'private') and is_mod(msg) then end 4 | 5 | if blocks[1] == 'groseria' then 6 | if not blocks[2]:match('^(enable)$') and not blocks[2]:match('^(disable)$') then 7 | api.sendReply(msg, '*ERROR*\nDebe usarse de esta manera:\n`/groseria enable|disable`', true) 8 | return 9 | end 10 | local status = blocks[2] 11 | local current = db:hget('chat:'..msg.chat.id..':settings', 'groseria') 12 | if current == status then 13 | grep = status:gsub('^enable$', 'permitida'):gsub('^disable$', 'prohibida') 14 | api.sendMessage(msg.chat.id, 'Los groseria ya estaba *'..grep..'*', true) 15 | else 16 | db:hset('chat:'..msg.chat.id..':settings', 'groseria', status) 17 | grep = status:gsub('^enable$', 'permitida'):gsub('^disable$', 'prohibida') 18 | api.sendMessage(msg.chat.id, 'Ahora la groseria estará *'..grep..'*', true) 19 | end 20 | end 21 | 22 | 23 | if blocks[1] == 'bots' then 24 | if not blocks[2]:match('^(enable)$') and not blocks[2]:match('^(disable)$') then 25 | api.sendReply(msg, '*ERROR*\nDebe usarse de esta manera:\n`/bots enable|disable`', true) 26 | return 27 | end 28 | local status = blocks[2] 29 | local current = db:hget('chat:'..msg.chat.id..':settings', 'bots') 30 | if current == status then 31 | grep = status:gsub('^enable$', 'permitidos'):gsub('^disable$', 'prohibidos') 32 | api.sendMessage(msg.chat.id, 'Los bots ya estaban *'..grep..'*', true) 33 | else 34 | db:hset('chat:'..msg.chat.id..':settings', 'bots', status) 35 | grep = status:gsub('^enable$', 'permitidos'):gsub('^disable$', 'prohibidos') 36 | api.sendMessage(msg.chat.id, 'Ahora los bots estarán *'..grep..'*', true) 37 | end 38 | end 39 | 40 | 41 | if blocks[1] == 'spam' then 42 | if not blocks[2]:match('^(enable)$') and not blocks[2]:match('^(disable)$') then 43 | api.sendReply(msg, '*ERROR*\nDebe usarse de esta manera:\n`/spam enable|disable`', true) 44 | return 45 | end 46 | local status = blocks[2] 47 | local current = db:hget('chat:'..msg.chat.id..':settings', 'spam') 48 | if current == status then 49 | grep = status:gsub('^enable$', 'permitido'):gsub('^disable$', 'prohibido') 50 | api.sendMessage(msg.chat.id, 'El spam ya estaba *'..grep..'*', true) 51 | else 52 | db:hset('chat:'..msg.chat.id..':settings', 'spam', status) 53 | grep = status:gsub('^enable$', 'permitido'):gsub('^disable$', 'prohibido') 54 | api.sendMessage(msg.chat.id, 'Ahora el spam estará *'..grep..'*', true) 55 | end 56 | end 57 | 58 | if blocks[1] == 'codes' then 59 | if not blocks[2]:match('^(enable)$') and not blocks[2]:match('^(disable)$') then 60 | api.sendReply(msg, '*ERROR*\nDebe usarse de esta manera:\n`/codes enable|disable`', true) 61 | return 62 | end 63 | local status = blocks[2] 64 | local current = db:hget('chat:'..msg.chat.id..':settings', 'codes') 65 | if current == status then 66 | grep = status:gsub('^enable$', 'permitido'):gsub('^disable$', 'prohibido') 67 | api.sendMessage(msg.chat.id, 'El codes ya estaba *'..grep..'*', true) 68 | else 69 | db:hset('chat:'..msg.chat.id..':settings', 'codes', status) 70 | grep = status:gsub('^enable$', 'permitido'):gsub('^disable$', 'prohibido') 71 | api.sendMessage(msg.chat.id, 'Ahora el codes estará *'..grep..'*', true) 72 | end 73 | end 74 | 75 | if blocks[1] == 'saludo' then 76 | if not blocks[2]:match('^(enable)$') and not blocks[2]:match('^(disable)$') then 77 | api.sendReply(msg, '*ERROR*\nDebe usarse de esta manera:\n`/saludo enable|disable`', true) 78 | return 79 | end 80 | local status = blocks[2] 81 | local current = db:hget('chat:'..msg.chat.id..':settings', 'saludo') 82 | if current == status then 83 | grep = status:gsub('^enable$', 'permitido'):gsub('^disable$', 'prohibido') 84 | api.sendMessage(msg.chat.id, 'El saludo ya estaba *'..grep..'*', true) 85 | else 86 | db:hset('chat:'..msg.chat.id..':settings', 'saludo', status) 87 | grep = status:gsub('^enable$', 'permitido'):gsub('^disable$', 'prohibido') 88 | api.sendMessage(msg.chat.id, 'Ahora el saludo estará *'..grep..'*', true) 89 | end 90 | end 91 | end 92 | 93 | return { 94 | action = action, 95 | triggers = { 96 | '^/(groseria) (%a+)$', 97 | '^/(groseria)(.-)$', 98 | '^/(bots) (%a+)$', 99 | '^/(bots)(.-)$', 100 | '^/(spam) (%a+)$', 101 | '^/(spam)(.-)$', 102 | '^/(codes) (%a+)$', 103 | '^/(codes)(.-)$', 104 | '^/(saludo) (%a+)$', 105 | '^/(saludo)(.-)$' 106 | } 107 | } -------------------------------------------------------------------------------- /plugins/codes.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks) 2 | 3 | if db:hget('chat:'..msg.chat.id..':settings', 'codes') == 'enable' then 4 | local d = blocks[1] 5 | api.sendMessage(msg.chat.id, d, true) 6 | 7 | end 8 | end 9 | 10 | return { 11 | action = action, 12 | triggers = { 13 | '- (.*)$', 14 | } 15 | } -------------------------------------------------------------------------------- /plugins/comprimirlink.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, matches, ln) 2 | api.sendMessage(msg.chat.id, make_text '*Link comprimido.*\n\n¡Hola! Te invito a ingresar a este [link](' ..matches[1].. ')\n\n_Reenvialo para que tus amigos lo vean._', true) 3 | mystat('/comprimir') --save stats 4 | end 5 | 6 | return { 7 | action = action, 8 | triggers = { 9 | '^/[Cc]omprimir (.*)$' 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /plugins/configure.lua: -------------------------------------------------------------------------------- 1 | local function do_keyboard_config(chat_id) 2 | local keyboard = { 3 | inline_keyboard = { 4 | {{text = '🛠 Menu', callback_data = 'dashboard:settings:'..chat_id}}, 5 | {{text = '⚡️ Antiflood', callback_data = 'dashboard:flood:'..chat_id}}, 6 | {{text = '🌈 Media', callback_data = 'dashboard:media:'..chat_id}}, 7 | } 8 | } 9 | 10 | return keyboard 11 | end 12 | 13 | 14 | local function action(msg, blocks) 15 | if msg.chat.type == 'private' and not msg.cb then return end 16 | local chat_id = msg.target_id or msg.chat.id 17 | local keyboard = do_keyboard_config(chat_id) 18 | if msg.cb then 19 | chat_id = msg.target_id 20 | api.editMessageText(msg.chat.id, msg.message_id, '_Navigate the keyboard to change the settings_', keyboard, true) 21 | else 22 | if not is_admin_cached(msg) then return end 23 | local res = api.sendKeyboard(msg.from.id, '_Navigate the keyboard to change the settings_', keyboard, true) 24 | if not is_silentmode_on(msg.chat.id) then --send the responde in the group only if the silent mode is off 25 | if res then 26 | api.sendMessage(msg.chat.id, '_I\'ve sent you the keyboard in private_', true) 27 | else 28 | sendStartMe(msg, msg.ln) 29 | end 30 | end 31 | end 32 | end 33 | 34 | return { 35 | action = action, 36 | triggers = { 37 | config.cmd..'config$', 38 | '^###cb:config:back:' 39 | } 40 | } -------------------------------------------------------------------------------- /plugins/contact.lua: -------------------------------------------------------------------------------- 1 | local triggers = { 2 | '^/(mensaje) (.*) (.*)$', 3 | '^/(responder) (.*)' 4 | } 5 | 6 | local action = function(msg, blocks) 7 | --if msg.from.id == config.admin or mag.from.id == config.support then 8 | -- return 9 | -- end 10 | if blocks[1] == 'mensaje' then 11 | idto = blocks[3] 12 | message = blocks[2] 13 | nameowner = msg.from.first_name 14 | api.sendMessage(idto, message.. '\n\nEnviado por: ' ..nameowner.. '\n_Contesta con /responder [respuesta]_', true) 15 | api.sendMessage(msg.chat.id, '¡Mensaje enviado!') 16 | end 17 | if blocks[1] == 'responder' then 18 | iduser = msg.from.id 19 | name = msg.from.first_name 20 | user = msg.from.username 21 | message = blocks[2] 22 | api.sendMessage(config.admin, make_text'' ..message.. '\n\n_ID Del Usuario_: ' ..iduser.. '\n_Nombre_: ' ..name.. '\n_Usuario_: @' ..user, true) 23 | api.sendMessage(config.support, make_text'' ..message.. '\n\n_ID Del Usuario_: ' ..iduser.. '\n_Nombre_: ' ..name.. '\n_Usuario_: @' ..user, true) 24 | api.sendMessage(msg.chat.id, '¡Respuesta enviada!') 25 | end 26 | -- if blocks[1] == 'duda' or blocks[1] == 'ayuda' or blocks[1] == 'soporte' then 27 | -- api.sendMessage(config.support, message.. '\n\n_ID Del Usuario:_ ' ..iduser, true) 28 | -- api.sendMessage(msg.chat.id, '¡Respuesta enviada al equipo de soporte!') 29 | -- end 30 | end 31 | 32 | return { 33 | triggers = triggers, 34 | action = action 35 | } 36 | -------------------------------------------------------------------------------- /plugins/error.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks) 2 | if blocks[1] == 'a' then 3 | api.sendReply(msg, make_text '*ERROR*\n`Debes ingresar un texto despúes del comando`.', true) 4 | end 5 | end 6 | 7 | return { 8 | action = action, 9 | triggers = { 10 | '^/[Cc]aracolamagic(a)$', 11 | '^/[Cc]aracol(a)$', 12 | '^/ser(a)$' 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /plugins/extra.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks, ln) 2 | 3 | if msg.chat.type == 'private' then return end 4 | 5 | if blocks[1] == 'extra' then 6 | if not is_mod(msg) then return end 7 | if not blocks[2] then return end 8 | if not blocks[3] and not msg.reply then return end 9 | 10 | if msg.reply and not blocks[3] then 11 | local file_id, media_with_special_method = get_media_id(msg.reply) 12 | if not file_id then 13 | return 14 | else 15 | local to_save 16 | if media_with_special_method then --photo, voices, video need their method to be sent by file_id 17 | to_save = '###file_id!'..media_with_special_method..'###:'..file_id 18 | else 19 | to_save = '###file_id###:'..file_id 20 | end 21 | db:hset('chat:'..msg.chat.id..':extra', blocks[2], to_save) 22 | api.sendReply(msg, 'This media has been saved as response to '..blocks[2]) 23 | end 24 | else 25 | local hash = 'chat:'..msg.chat.id..':extra' 26 | 27 | local res, code = api.sendReply(msg, blocks[3], true) 28 | if not res then 29 | if code == 118 then 30 | api.sendMessage(msg.chat.id, lang[ln].bonus.too_long) 31 | else 32 | api.sendMessage(msg.chat.id, lang[ln].breaks_markdown, true) 33 | end 34 | else 35 | db:hset(hash, blocks[2], blocks[3]) 36 | local msg_id = res.result.message_id 37 | api.editMessageText(msg.chat.id, msg_id, make_text(lang[ln].extra.setted, blocks[2]), false) 38 | end 39 | end 40 | elseif blocks[1] == 'extra list' then 41 | if not is_mod(msg) then return end 42 | 43 | local hash = 'chat:'..msg.chat.id..':extra' 44 | local commands = db:hkeys(hash) 45 | local text = '' 46 | if commands[1] == nil then 47 | api.sendReply(msg, lang[ln].extra.no_commands) 48 | else 49 | for k,v in pairs(commands) do 50 | text = text..v..'\n' 51 | end 52 | local out = make_text(lang[ln].extra.commands_list, text) 53 | api.sendReply(msg, out, true) 54 | end 55 | elseif blocks[1] == 'extra del' then 56 | if not is_mod(msg) then return end 57 | 58 | local hash = 'chat:'..msg.chat.id..':extra' 59 | local success = db:hdel(hash, blocks[2]) 60 | if success == 1 then 61 | local out = make_text(lang[ln].extra.command_deleted, blocks[2]) 62 | api.sendReply(msg, out) 63 | else 64 | local out = make_text(lang[ln].extra.command_empty, blocks[2]) 65 | api.sendReply(msg, out) 66 | end 67 | else 68 | local hash = 'chat:'..msg.chat.id..':extra' 69 | local text = db:hget(hash, blocks[1]) 70 | if not text then return end 71 | local file_id = text:match('^###.+###:(.*)') 72 | local special_method = text:match('^###file_id!(.*)###') --photo, voices, video need their method to be sent by file_id 73 | if is_locked(msg, 'Extra') and not is_mod(msg) then --send it in private 74 | if not file_id then 75 | api.sendMessage(msg.from.id, text, true) 76 | else 77 | if special_method then 78 | api.sendMediaId(msg.from.id, file_id, special_method) --photo, voices, video need their method to be sent by file_id 79 | else 80 | api.sendDocumentId(msg.from.id, file_id) 81 | end 82 | end 83 | else 84 | local msg_to_reply 85 | if msg.reply then 86 | msg_to_reply = msg.reply.message_id 87 | else 88 | msg_to_reply = msg.message_id 89 | end 90 | if file_id then 91 | if special_method then 92 | api.sendMediaId(msg.chat.id, file_id, special_method, msg_to_reply) --photo, voices, video need their method to be sent by file_id 93 | else 94 | api.sendDocumentId(msg.chat.id, file_id, msg_to_reply) 95 | end 96 | else 97 | api.sendMessage(msg.chat.id, text, true, msg_to_reply) --if the mod replies to an user, the bot will reply to the user too 98 | end 99 | end 100 | end 101 | end 102 | 103 | return { 104 | action = action, 105 | triggers = { 106 | config.cmd..'(extra)$', 107 | config.cmd..'(extra) (#[%s_]*)%s(.*)$', 108 | config.cmd..'(extra) (#[%s_]*)', 109 | config.cmd..'(extra del) (#[%s_]*)$', 110 | config.cmd..'(extra list)$', 111 | '^(#[%s_]*)$' 112 | } 113 | } -------------------------------------------------------------------------------- /plugins/faq.lua: -------------------------------------------------------------------------------- 1 | local function action(msg, blocks, ln) 2 | 3 | local questions = { 4 | 'Can you make a command to delete ?', 5 | 'Can you add a function to kick/ban who writes a specific word?', 6 | 'How do I promote the bot as a group Admin?', 7 | 'What does the "wrong markdown" message mean?', 8 | 'Why I can\'t global ban users?', 9 | 'Why sometimes commands by username are sooo slow?', 10 | 'How can I clone the bot? I\'m getting error, I need help', 11 | 'Why I can\'t contact you in private?', 12 | 'Why I\'m warned by the bot to reply to someone, even if I\'ve replied to a message?', 13 | 'Can you add language?', 14 | 'What does this bot store? Why can he access all the messages?', 15 | 'Can you advertise my channel/bot in your channel/bot?', 16 | 'How do I report a bug? Which informations do you need?', 17 | 'How many groups does the bot administrate?', 18 | 'What can the bot owner do?', 19 | 'Some strings of my language are not updated. What can I do?', 20 | 'Why this faq are not translated in the supported languages?', 21 | 'Why this faq are not sent with an inline keyboard?', 22 | 'Why the bot doesn\'t report something flagged with the @admin command to all the group admins?', 23 | 'A bot is spamming, why the antiflood can\'t kick it?', 24 | 'Would you like to collaborate to a project? Like a groups network?', 25 | 'Where are you from?', 26 | 'Can I move my group info to another group?', 27 | 'Will you ever add other plugins not related to the group administration? Like something to search on google, to get a definition from UD..?', 28 | 'Please add an anti-emoji system', 29 | 'Can you make the "anti media" directly kick/ban instead of warn? Or can you make the number of warns configurable?', 30 | 'Can you make something to block only Telegram links?', 31 | } 32 | 33 | local answer = { 34 | 'The Bot Api doesn\'t offer a method to delete message, but the Bot Support said that this feature will arrive. You can read the conversation [here](https://telegram.me/GroupButler_ch/32)', 35 | 'I\'ve received many requests about this feature, I\'m sorry but I think everyone could avoid the words check just by changing an "_E_ " with a "_3_ ", or in general every character can be replaced with any other character. This function will probably added when bots can delete messages, but is not 100% confirmed', 36 | 'First, make sure your client is updated to the latest version.\n\n*Normal groups*: group info screen, click on "administrators", under the group name. Remove the check from "all the member are admins", and select the bot. Then save.\n\n*Supergroups*: from the group info screen, click on "administrators" (Telegram Desktop: under the group name, Android client: three dots menu in the upper right corner, iOS/Webogram: never tried), than on "new administrator" and search for the bot username, then select it and save.\n\nIf you are trying to promote the bot in a supergroup and you can\'t find the bot username, well, I really don\'t know how to solve this problem :)', 37 | 'It means that the message can\'t be sent back to you, because of a wrong number of \\_ or \\* or other markdown symbols. More info [here](https://telegram.me/GroupButler_ch/46)', 38 | 'This is a public bot, this means that everyone can use it and add it to their group. A user you don\'t like to see in your groups, could be not be a problem in others. Or maybe he\'s using the bot too. A global ban would be pointless.', 39 | 'Commands by username are so slower than commands by reply because a bot can\'t retrieve a user id from a username. I need to store a table of ids and usernames, then I have to search the username and get the related id. Each group has its own table of usernames, but if a username is not found locally, it is searched in the global one. So in this case the research could be a bit slow. Tables are updated on each message.', 40 | 'All the instructions are in the github page [here](https://github.com//RememberTheAir). I won\'t give any kind of support in the installation/configuartion/manteinence of the bot. For four reasons: I\'m a noob, I have few time, the bot is easy to install and Lua is a very friendly language. If you need support, there are tons of bot development groups around Telegram. You can ask there, you could find me, and probably you will find a lof of more competent people than me.', 41 | 'Because the "_/c_ " command can do everything we need to communicate. And I don\'t want to be reported when talking to other people. And I don\'t want to be directly reachable 24/7 too. The bot command will group all the questions in one handy chat, and I can reply when I have time without worries about the double tics. As always, I\'ll try to reply to every question.', 42 | 'This usually happens if you reply to a message of an user that contains the username of another bot. So the message can\'t be seen by GroupButler.', 43 | 'I can\'t, I know only my native language (_italian_ ) and my English, as you can see, it\'s not good.\nBut you can :) Translations are open to everyone: if you need the bot to talk in your native language, you are free to translate all (or only partially) the strings of the bot.\n To see how, send /help in the private chat with the bot, tap on "all commands", then on "admin", and then on "languages". There you will find all the instructions.', 44 | 'The bot has the acces to all the messages because it needs to see replied messages. And, another thing: when a bot is promoted as admin, it has always access to all the messages, no matter of the settings of BotFather.\nAbout what the bot stores:\n- Description, rules, #extra commands, welcome message if customized\n- It stores the ID associated with its username of every user it find: this is needed for commands by username\n- It stores the number of messages sent by a user in a group and the number of commands used by a user\n\nMedia and messages are not stored by the bot, it\'s something it will never do.', 45 | '*No*. I don\'t care if you will return the favor or how many subscribers you channel has.\nI\'m saying this because I\'m tired to receive all this kind of requests.', 46 | 'I really appreciate any kind of bug report. It would be great if you provide some extra info to the message, for example: if the bot has replied something, if it happened more than one time, if you are facing the problme in other groups too, if the group is a normal group or a supergroup. I really like screenshots too, you can forward me an image by sending it to the bot and then replying to it with "/c".\nAh, an "hello" to start the message will be really appreciated :)', 47 | 'Wew, I don\'t know the right answer. Probably around 1500 groups. My counter shows 3600, but considering the bot sometimes doesn\'t know when it is removed from a group, I assume that I should take for good 1/2 of the number displayed.\nOther numbers: the bot has been started by almost 10.000 users, and has processed more or less 8 milion messages, and received almost 300.000 queries', 48 | 'Well, not much, all the privileged functions are made for debugging purpose.\nThe most rilevant functions I can use: see the bot stats, query the database, broadcast to groups and users (even if I never do it, i find it annoiyng for users), send a message in a group/to an user, post in the selected channel with the bot, make the bot leave a chat, turn on the admin mode (the bot can\'t be added to new groups), migrate the group info to a new group, global ban an user (even if I won\'t never use this function), block an user (will be ignored by the bot). And some other useless things', 49 | 'If you want to translate them, you can run "/strings [your language code]" to get the most updated file with all the translated and untranslated strings. The steps to follow are the same of a normal translation', 50 | 'Because I\'m lazy :P', 51 | 'Will arrive ;)', 52 | 'Probably, they haven\'t started the bot yet. Bots can\'t write to an user if not started first', 53 | 'Bots can\'t see the messages sent by other bots, so it\'s not possible to detect the spam from other bots', 54 | 'No, sorry but I\'m not interested in ths kind of things. I don\'t want to associate the bot with small/big Telegram Networks or with other bots which do the same thing.', 55 | 'This could sound wierd, but a lot of people start a conversation with this question. I\'m from Italy. And, just to put the record straight, the "/c" command is not intended to start a random conversation with me. It shoud be a fast way to get direct support, nothing else.', 56 | 'Yes, yes you can. But you need to contact me with "/c" command, and provide the ids of both the old and the new groups. And you need to be the creator of both the groups, or at leat creator of the old and admin of the new one.', 57 | 'No, I\'m not going to add recreative things. I want to keep the bot focused on what is doing now, and less invasive as possible in the group chat.', 58 | 'I\'m not going to add this dictatorial things. In my opinion, the bot already allows you to block everything could be source of spam or off-topic in a group, and for me it already feels like an Hitlerian weapon for a paranoid admin.', 59 | 'This "media warns" system will change as soon as I have some time to make some tests. For now it will stay as it is. My idea is to allow Admins to choose how many warns are needed to kick someone for posting a forbidden media. I\'ll see', 60 | 'No, the current system uses a nice field in the messages object given by the api that includes all the links in a message, I\'m not going to add other plugins with arranged triggers only for Telegram links. I\'m sorry :(', 61 | 62 | } 63 | 64 | local text 65 | 66 | if not blocks[2] then 67 | local i = 1 68 | text = '*All the available questions*. Type `/faq [question number]` to get the anwer\n\n' 69 | for k,v in pairs(questions) do 70 | text = text..'*'..i..'* - `'..v..'`\n' 71 | i = i + 1 72 | end 73 | api.sendMessage(msg.from.id, text, true) 74 | end 75 | if blocks[2] then 76 | local n = tonumber(blocks[2]) 77 | if n > #answer or n == 0 then 78 | api.sendMessage(msg.from.id, '_Number not valid_', true) 79 | else 80 | text = '*'..questions[n]..'*\n\n'..answer[n] 81 | api.sendMessage(msg.from.id, text, true) 82 | end 83 | end 84 | end 85 | 86 | return { 87 | action = action, 88 | triggers = { 89 | '^/(faq)$', 90 | '^/(faq) (%d%d?)', 91 | } 92 | } -------------------------------------------------------------------------------- /plugins/flag.lua: -------------------------------------------------------------------------------- 1 | local function get_mods_id(chat_id) 2 | local res = api.getChatAdministrators(chat_id) 3 | if not res then return false end 4 | local ids = {} 5 | for i,admin in pairs(res.result) do 6 | table.insert(ids, admin.user.id) 7 | end 8 | return ids 9 | end 10 | 11 | local function is_report_blocked(msg) 12 | local hash = 'chat:'..msg.chat.id..':reportblocked' 13 | return db:sismember(hash, msg.from.id) 14 | end 15 | 16 | local function send_to_admin(mods, chat, msg_id, reporter, is_by_reply, chat_title) 17 | for i=1,#mods do 18 | api.forwardMessage(mods[i], chat, msg_id) 19 | if is_by_reply then api.sendMessage(mods[i], reporter..'\n\n'..chat_title) end 20 | end 21 | end 22 | 23 | local action = function(msg, blocks, ln) 24 | 25 | if msg.chat.type == 'private' then return end 26 | 27 | local hash = 'chat:'..msg.chat.id..':reportblocked' 28 | if blocks[1] == 'admin' then 29 | --return nil if 'report' is locked, if is a mod or if the user is blocked from using @admin 30 | if is_locked(msg, 'Report') or is_mod(msg) or is_report_blocked(msg) then 31 | return 32 | end 33 | if not blocks[2] and not msg.reply then 34 | api.sendReply(msg, lang[ln].flag.no_input) 35 | else 36 | if is_report_blocked(msg) then 37 | return 38 | end 39 | if msg.reply and ((tonumber(msg.reply.from.id) == tonumber(bot.id)) --[[or is_mod(msg.reply)]]) then 40 | return 41 | end 42 | local mods = get_mods_id(msg.chat.id) 43 | if not mods then 44 | api.sendReply(msg, lang[ln].bonus.adminlist_admin_required, true) 45 | end 46 | local msg_id = msg.message_id 47 | local is_by_reply = false 48 | if msg.reply then 49 | is_by_reply = true 50 | msg_id = msg.reply.message_id 51 | end 52 | local reporter = msg.from.first_name 53 | if msg.from.username then reporter = reporter..' (@'..msg.from.username..')' end 54 | send_to_admin(mods, msg.chat.id, msg_id, reporter, is_by_reply, msg.chat.title) 55 | api.sendReply(msg, lang[ln].flag.reported) 56 | end 57 | end 58 | if blocks[1] == 'report' then 59 | if is_mod(msg) then 60 | if not msg.reply then 61 | api.sendReply(msg, lang[ln].flag.no_reply) 62 | else 63 | if blocks[2] == 'off' then 64 | local result = db:sadd(hash, msg.reply.from.id) 65 | if result == 1 then 66 | api.sendReply(msg, lang[ln].flag.blocked) 67 | elseif result == 0 then 68 | api.sendReply(msg, lang[ln].flag.already_blocked) 69 | end 70 | elseif blocks[2] == 'on' then 71 | local result = db:srem(hash, msg.reply.from.id) 72 | if result == 1 then 73 | api.sendReply(msg, lang[ln].flag.unblocked) 74 | elseif result == 0 then 75 | api.sendReply(msg, lang[ln].flag.already_unblocked) 76 | end 77 | end 78 | end 79 | end 80 | end 81 | end 82 | 83 | return { 84 | action = action, 85 | triggers = { 86 | '^@(admin)$', 87 | '^@(admin) (.*)$', 88 | '^/(report) (on)$', 89 | '^/(report) (off)$', 90 | } 91 | } -------------------------------------------------------------------------------- /plugins/floodmanager.lua: -------------------------------------------------------------------------------- 1 | local function do_keyboard_flood(chat_id, ln) 2 | --no: enabled, yes: disabled 3 | local status = db:hget('chat:'..chat_id..':settings', 'Flood') or 'yes' --check (default: disabled) 4 | if status == 'no' then 5 | status = '✅ | ON' 6 | elseif status == 'yes' then 7 | status = '❌ | OFF' 8 | end 9 | 10 | local hash = 'chat:'..chat_id..':flood' 11 | local action = (db:hget(hash, 'ActionFlood')) or 'kick' 12 | if action == 'kick' then 13 | action = '⚡️ '..action 14 | else 15 | action = '⛔ ️'..action 16 | end 17 | local num = (db:hget(hash, 'MaxFlood')) or 5 18 | local keyboard = { 19 | inline_keyboard = { 20 | { 21 | {text = status, callback_data = 'flood:status:'..chat_id}, 22 | {text = action, callback_data = 'flood:action:'..chat_id}, 23 | }, 24 | { 25 | {text = '➖', callback_data = 'flood:dim:'..chat_id}, 26 | {text = num, callback_data = 'flood:alert:num'}, 27 | {text = '➕', callback_data = 'flood:raise:'..chat_id}, 28 | } 29 | } 30 | } 31 | 32 | local exceptions = { 33 | ['text'] = lang[ln].floodmanager.text, 34 | ['sticker'] = lang[ln].floodmanager.sticker, 35 | ['image'] = lang[ln].floodmanager.image, 36 | ['gif'] = lang[ln].floodmanager.gif, 37 | ['video'] = lang[ln].floodmanager.video 38 | } 39 | hash = 'chat:'..chat_id..':floodexceptions' 40 | for media, translation in pairs(exceptions) do 41 | --ignored by the antiflood-> yes, no 42 | local exc_status = (db:hget(hash, media)) or 'no' 43 | if exc_status == 'yes' then 44 | exc_status = '✅' 45 | else 46 | exc_status = '❌' 47 | end 48 | local line = { 49 | {text = translation, callback_data = 'flood:alert:voice'}, 50 | {text = exc_status, callback_data = 'flood:exc:'..media..':'..chat_id}, 51 | } 52 | table.insert(keyboard.inline_keyboard, line) 53 | end 54 | 55 | return keyboard 56 | end 57 | 58 | local function action(msg, blocks, ln) 59 | 60 | if not msg.cb and msg.chat.type == 'private' then return end 61 | 62 | local chat_id 63 | if msg.cb then 64 | chat_id = msg.target_id 65 | else 66 | chat_id = msg.chat.id 67 | end 68 | 69 | local text, keyboard 70 | 71 | if not msg.cb then 72 | if not is_mod(msg) then return end 73 | if blocks[1]:match('%d%d?') then 74 | if tonumber(blocks[1]) < 4 or tonumber(blocks[1]) > 25 then 75 | api.sendReply(msg, make_text(lang[ln].floodmanager.number_invalid, blocks[1]), true) 76 | else 77 | local new = tonumber(blocks[1]) 78 | local old = tonumber(db:hget('chat:'..msg.chat.id..':flood', 'MaxFlood')) or 5 79 | if new == old then 80 | api.sendReply(msg, make_text(lang[ln].floodmanager.not_changed, new), true) 81 | else 82 | db:hset('chat:'..msg.chat.id..':flood', 'MaxFlood', new) 83 | api.sendReply(msg, make_text(lang[ln].floodmanager.changed_plug, old, new), true) 84 | end 85 | end 86 | return 87 | end 88 | text = lang[ln].floodmanager.header 89 | keyboard = do_keyboard_flood(chat_id, ln) 90 | local res = api.sendKeyboard(msg.from.id, text, keyboard, true) 91 | if not res then 92 | cross.sendStartMe(msg, ln) 93 | else 94 | api.sendReply(msg, lang[ln].floodmanager.sent, true) 95 | end 96 | else 97 | if blocks[1] == 'alert' then 98 | if blocks[2] == 'num' then 99 | text = '⚖'..lang[ln].floodmanager.number_cb 100 | elseif blocks[2] == 'voice' then 101 | text = '⚠️ '..lang[ln].bonus.menu_cb_media 102 | end 103 | api.answerCallbackQuery(msg.cb_id, text) 104 | return 105 | end 106 | 107 | if blocks[1] == 'exc' then 108 | local media = blocks[2] 109 | local hash = 'chat:'..chat_id..':floodexceptions' 110 | local status = (db:hget(hash, media)) or 'no' 111 | if status == 'no' then 112 | db:hset(hash, media, 'yes') 113 | text = '❎ '..make_text(lang[ln].floodmanager.ignored, media) 114 | else 115 | db:hset(hash, media, 'no') 116 | text = '🚫 '..make_text(lang[ln].floodmanager.not_ignored, media) 117 | end 118 | end 119 | 120 | local action 121 | if blocks[1] == 'action' or blocks[1] == 'dim' or blocks[1] == 'raise' then 122 | if blocks[1] == 'action' then 123 | action = (db:hget('chat:'..chat_id..':flood', 'ActionFlood')) or 'kick' 124 | elseif blocks[1] == 'dim' then 125 | action = -1 126 | elseif blocks[1] == 'raise' then 127 | action = 1 128 | end 129 | text = cross.changeFloodSettings(chat_id, action, ln):mEscape_hard() 130 | end 131 | 132 | if blocks[1] == 'status' then 133 | local status = db:hget('chat:'..chat_id..':settings', 'Flood') or 'yes' 134 | text = cross.changeSettingStatus(chat_id, 'Flood', ln):mEscape_hard() 135 | end 136 | 137 | keyboard = do_keyboard_flood(chat_id, ln) 138 | api.editMessageText(msg.chat.id, msg.message_id, lang[ln].floodmanager.header, keyboard, true) 139 | api.answerCallbackQuery(msg.cb_id, text) 140 | end 141 | end 142 | 143 | return { 144 | action = action, 145 | triggers = { 146 | '^/antiflood$', 147 | '^/antiflood (%d%d?)$', 148 | '^###cb:flood:(alert):(%w+)$', 149 | '^###cb:flood:(status):(-%d+)$', 150 | '^###cb:flood:(action):(-%d+)$', 151 | '^###cb:flood:(dim):(-%d+)$', 152 | '^###cb:flood:(raise):(-%d+)$', 153 | '^###cb:flood:(exc):(%a+):(-%d+)$', 154 | } 155 | } -------------------------------------------------------------------------------- /plugins/gban.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks, ln) 2 | 3 | if not(msg.chat.type == 'private') and not is_owner(msg) then return end 4 | 5 | if blocks[1] == "gban" then 6 | local id 7 | local name 8 | if not blocks[2] then 9 | if not msg.reply then 10 | api.sendReply(msg, 'Este comando necesita una respuesta, o el Id para funcionar') 11 | return 12 | else 13 | id = msg.reply.from.id 14 | name = msg.from.first_name 15 | if msg.from.username then name = name..' (@'..msg.from.username..')' end 16 | end 17 | else 18 | id = blocks[2] 19 | name = msg.from.first_name 20 | if msg.from.username then name = name..' (@'..msg.from.username..')' end 21 | end 22 | if msg.reply then 23 | os.execute('echo "' ..id.. '," >> ./data/gbans') 24 | bot_init(true) 25 | end 26 | if blocks[2] then 27 | os.execute('echo "' ..blocks[2].. '," >> ./data/gbans') 28 | bot_init(true) 29 | end 30 | local response = db:sadd('bot:blocked', id) 31 | local text 32 | if response == 1 then 33 | text = '\n' ..name.. ', el ID ' ..id.. ' ha sido Bloqueado y Baneado Globalmente por @' ..bot.username.. ', si crees que es un error, contacta a @Webrom o @Webrom2 para que pueda revisar tu caso, gracias. 🔰\n' 34 | -- text = id..' Has sido Bloqueado y expulsado Globalmente' 35 | else 36 | text = '\n' ..name.. ', el ID ' ..id.. ' ya ha sido Bloqueado y Baneado Globalmente por @' ..bot.username.. ', si crees que es un error, contacta a @Webrom o @Webrom2 para que pueda revisar tu caso, gracias. 🔰\n' 37 | -- text = id..' Ya estás Bloqueado y expulsado Globalmente' 38 | end 39 | api.sendReply(msg, text) 40 | end 41 | 42 | if blocks[1] == 'ungban' then 43 | local id 44 | local name 45 | if not blocks[2] then 46 | if not msg.reply then 47 | api.sendReply(msg, 'Este comando necesita una respuesta, o el Id para funcionar') 48 | return 49 | else 50 | id = msg.reply.from.id 51 | name = msg.from.first_name 52 | if msg.from.username then name = name..' (@'..msg.from.username..')' end 53 | end 54 | else 55 | id = blocks[2] 56 | name = msg.from.first_name 57 | if msg.from.username then name = name..' (@'..msg.from.username..')' end 58 | end 59 | if msg.reply then 60 | os.execute('sed -i "/' ..id.. '/d" ./data/gbans') 61 | bot_init(true) 62 | end 63 | if blocks[2] then 64 | os.execute('sed -i "/' ..blocks[2].. '/d" ./data/gbans') 65 | bot_init(true) 66 | end 67 | local response = db:srem('bot:blocked', id) 68 | local text 69 | if response == 1 then 70 | make_text = '\n' ..name.. ', el ID ' ..id.. ' ha sido Desbloqueado y Desbaneado Globalmente por (@' ..bot.username.. '), si fue un error, disculpa las molestias, gracias. 🔰\n' 71 | -- text = id..' Has sido Desbloqueado y desbaneado Globalmente' 72 | else 73 | make_text = '\n' ..name.. ', el ID ' ..id.. ' ya ha sido Desbloqueado y Desbaneado Globalmente por (@' ..bot.username.. '), gracias. 🔰\n' 74 | -- text = id..' Ya estás Desbloqueado y desbaneado Globalmente' 75 | end 76 | api.sendReply(msg, make_text) 77 | end 78 | 79 | if blocks[1] == "isgban" then 80 | if blocks[2] then 81 | local grep = io.popen("grep -o "..blocks[2].. " ./data/gbans") 82 | local list = grep:read("*a") 83 | if list == "" then 84 | api.sendMessage(msg.chat.id, "_Esta ID no esta globalmente baneada_", true) 85 | else 86 | api.sendReply(msg, "La ID "..blocks[2].." está *globalmente baneada*", true) 87 | -- api.sendMessage(msg.chat.id, "*Demasiado seguro*\nSe encontraron las siguientes coincidencias:\n\n_"..list.."_", true) 88 | end 89 | end 90 | 91 | if not blocks[2] then 92 | if msg.reply then 93 | local grep = io.popen("grep "..msg.reply.from.id.. " ./data/gbans") 94 | local list = grep:read("*a") 95 | if list == "" then 96 | api.sendReply(msg, "_Esta ID no esta globalmente baneada_", true) 97 | else 98 | api.sendReply(msg, "La ID "..msg.reply.from.id.." está *globalmente baneada*", true) 99 | end 100 | end 101 | end 102 | end 103 | end 104 | 105 | return { 106 | action = action, 107 | triggers = { 108 | '^/(gban) (%d+)$', 109 | '^/(gban)$', 110 | '^/(ungban) (%d+)$', 111 | '^/(ungban)$', 112 | '^/(isgban)$', 113 | '^/(isgban) (%d+)$' 114 | } 115 | } -------------------------------------------------------------------------------- /plugins/gbanner.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, matches) 2 | 3 | if not(msg.chat.type == 'private') and not is_mod(msg) then return end 4 | 5 | if matches[1] == "gban" then 6 | if matches[2] then 7 | os.execute('echo "' ..matches[2].. '," >> ./data/gbans') 8 | api.sendReply(msg, "ID " ..matches[2].. " *globalmente baneado*.", true) 9 | bot_init(true) 10 | end 11 | 12 | if not matches[2] then 13 | if msg.reply then 14 | os.execute('echo "' ..msg.reply.from.id.. '," >> ./data/gbans') 15 | api.sendReply(msg, "ID " ..msg.reply.from.id.. " *globalmente baneado*.", true) 16 | bot_init(true) 17 | else 18 | api.sendMessage(msg.chat.id, "Este comando necesita respuesta") 19 | end 20 | end 21 | end 22 | 23 | if matches[1] == "ungban" then 24 | 25 | if matches[2] then 26 | os.execute('sed -i "/' ..matches[2].. '/d" ./data/gbans') 27 | api.sendReply(msg, "ID " ..matches[2].. " *globalmente desbaneado*.", true) 28 | bot_init(true) 29 | end 30 | 31 | if not matches[2] then 32 | if msg.reply then 33 | os.execute('sed -i "/' ..msg.reply.from.id.. '/d" ./data/gbans') 34 | api.sendReply(msg, "ID " ..msg.reply.from.id.. " *globalmente desbaneado*.", true) 35 | bot_init(true) 36 | else 37 | api.sendMessage(msg.chat.id, "Este comando necesita respuesta") 38 | end 39 | end 40 | end 41 | 42 | if matches[1] == "isban" then 43 | 44 | if matches[2] then 45 | os.execute('grep -o "' ..matches[2].. '" ./data/gbans') 46 | api.sendReply(msg, "ID " ..matches[2].. " *ID se encuentra en BD*.", true) 47 | else 48 | os.execute('grep -o "' ..matches[2].. '" ./data/gbans') 49 | api.sendReply(msg, "ID " ..matches[2].. " *ID no se encuentra en BD*.", true) 50 | bot_init(true) 51 | end 52 | 53 | 54 | if not matches[2] then 55 | if msg.reply then 56 | os.execute('grep -c "' ..msg.reply.from.id.. '," ./data/gbans') 57 | api.sendReply(msg, "ID " ..msg.reply.from.id.. " *ID se encuentra en BD*.", true) 58 | bot_init(true) 59 | else 60 | api.sendMessage(msg.chat.id, "Este comando necesita respuesta") 61 | end 62 | end 63 | end 64 | end 65 | 66 | return { 67 | action = action, 68 | triggers = { 69 | '^/(gban)$', 70 | '^/(gban) (%d+)$', 71 | '^/(ungban)$', 72 | '^/(ungban) (%d+)$', 73 | '^/(isban)$', 74 | '^/(isban) (%d+)$' 75 | } 76 | } 77 | 78 | -------------------------------------------------------------------------------- /plugins/help.lua: -------------------------------------------------------------------------------- 1 | local function make_keyboard(mod, mod_current_position) 2 | local keyboard = {} 3 | keyboard.inline_keyboard = {} 4 | if mod then --extra options for the mod 5 | local list = { 6 | ['Adm. de Baneos'] = '!banhammer', 7 | ['Info. del Grupo'] = '!info', 8 | ['Adm. de Flood'] = '!flood', 9 | ['Ajustes Multimedia'] = '!media', 10 | ['Ajustes de Bienvenida'] = '!welcome', 11 | ['Ajustes Generales'] = '!settings', 12 | ['Comandos Extra'] = '!extra', 13 | ['Advertencias'] = '!warns', 14 | ['Caracteres Especiales'] = '!char', 15 | ['Links'] = '!links', 16 | ['Idiomas'] = '!lang' 17 | } 18 | local line = {} 19 | for k,v in pairs(list) do 20 | --if mod_current_position ~= v:gsub('!', '') then --(to remove the current tab button) 21 | if next(line) then 22 | local button = {text = '📍'..k, callback_data = v} 23 | --change emoji if it's the current position button 24 | if mod_current_position == v:gsub('!', '') then button.text = '💡 '..k end 25 | table.insert(line, button) 26 | table.insert(keyboard.inline_keyboard, line) 27 | line = {} 28 | else 29 | local button = {text = '📍'..k, callback_data = v} 30 | --change emoji if it's the current position button 31 | if mod_current_position == v:gsub('!', '') then button.text = '💡 '..k end 32 | table.insert(line, button) 33 | end 34 | --end --(to remove the current tab button) 35 | end 36 | if next(line) then --if the numer of buttons is odd, then add the last button alone 37 | table.insert(keyboard.inline_keyboard, line) 38 | end 39 | end 40 | local bottom_bar 41 | if mod then 42 | bottom_bar = {{text = '🔰 Todos los Usuarios', callback_data = '!user'}} 43 | else 44 | bottom_bar = {{text = '🔰 Sólo Admins', callback_data = '!mod'}} 45 | end 46 | table.insert(bottom_bar, {text = 'Info e Interés', callback_data = '!info_button'}) --insert the "Info" button 47 | table.insert(keyboard.inline_keyboard, bottom_bar) 48 | return keyboard 49 | end 50 | 51 | local function do_keyboard_credits() 52 | local keyboard = {} 53 | keyboard.inline_keyboard = { 54 | { 55 | {text = '✅ Canal', url = 'https://telegram.me/'..config.channel:gsub('@', '')}, 56 | {text = '✅ GitHub', url = 'https://github.com/ridrogo/ModeradorBot'}, 57 | }, 58 | { 59 | {text = '✅ Wamods.com', url = 'https://telegram.me/Wamods'}, 60 | {text = '✅ WereWolf Español Oficial', url = 'https://telegram.me/werewolfespoficial'}, 61 | }, 62 | { 63 | {text = '✅ Death Note Serie', url = 'https://telegram.me/DeathNoteSerie'}, 64 | {text = '✅ Evalúame!', url = 'https://telegram.me/storebot?start=GroupButlerEsp_bot'}, 65 | }, 66 | { 67 | {text = '🔙', callback_data = '!user'} 68 | } 69 | } 70 | return keyboard 71 | end 72 | 73 | local function do_keyboard_private() 74 | local keyboard = {} 75 | keyboard.inline_keyboard = { 76 | { 77 | {text = '👥 Agregame a tu grupo', url = 'https://telegram.me/'..bot.username..'?startgroup=new'}, 78 | {text = '📢 Canal de ayuda', url = 'https://telegram.me/'..config.channel:gsub('@', '')}, 79 | }, 80 | { 81 | {text = '📕 Todos los Comandos', callback_data = '!user'} 82 | } 83 | } 84 | return keyboard 85 | end 86 | 87 | local function do_keyboard_startme() 88 | local keyboard = {} 89 | keyboard.inline_keyboard = { 90 | { 91 | {text = 'Iniciame', url = 'https://telegram.me/'..bot.username} 92 | } 93 | } 94 | return keyboard 95 | end 96 | 97 | local action = function(msg, blocks, ln) 98 | -- save stats 99 | local keyboard = make_keyboard() 100 | if blocks[1] == 'start' then 101 | db:hset('bot:users', msg.from.id, 'xx') 102 | db:hincrby('bot:general', 'users', 1) 103 | if msg.chat.type == 'private' then 104 | local message = make_text(lang[ln].help.private, msg.from.first_name:mEscape()) 105 | local keyboard = do_keyboard_private() 106 | api.sendKeyboard(msg.from.id, message, keyboard, true) 107 | end 108 | return 109 | end 110 | local keyboard = make_keyboard() 111 | if blocks[1] == 'help' then 112 | if msg.chat.type == 'private' then 113 | local message = make_text(lang[ln].help.private, msg.from.first_name:mEscape()) 114 | local keyboard = do_keyboard_private() 115 | api.sendKeyboard(msg.from.id, message, keyboard, true) 116 | return 117 | end 118 | local res = api.sendKeyboard(msg.from.id, 'Elige un *rol* para ver los comandos disponibles:', keyboard, true) 119 | if res then 120 | api.sendMessage(msg.chat.id, lang[ln].help.group_success, true) 121 | else 122 | api.sendKeyboard(msg.chat.id, lang[ln].help.group_not_success, do_keyboard_startme(), true) 123 | end 124 | end 125 | local keyboard = make_keyboard() 126 | if blocks[1] == 'startme' then 127 | if msg.chat.type == 'private' then 128 | local message = make_text(lang[ln].help.private, msg.from.first_name:mEscape()) 129 | local keyboard = do_keyboard_private() 130 | api.sendKeyboard(msg.from.id, message, keyboard, true) 131 | return 132 | end 133 | local res = api.sendKeyboard(msg.from.id, 'Bienvenido a la pantalla de inicio, elige un *rol* para ver los comandos disponibles:', keyboard, true) 134 | if res then 135 | api.sendMessage(msg.chat.id, lang[ln].help.group_success, true) 136 | else 137 | api.sendKeyboard(msg.chat.id, lang[ln].help.group_not_success, do_keyboard_startme(), true) 138 | end 139 | end 140 | if msg.cb then 141 | local query = blocks[1] 142 | local text 143 | if query == 'info_button' then 144 | keyboard = do_keyboard_credits() 145 | api.editMessageText(msg.chat.id, msg.message_id, lang[ln].credits, keyboard, true) 146 | return 147 | end 148 | local with_mods_lines = true 149 | if query == 'user' then 150 | text = lang[ln].help.all 151 | with_mods_lines = false 152 | elseif query == 'mod' then 153 | text = lang[ln].help.kb_header 154 | end 155 | if query == 'info' then 156 | text = lang[ln].help.mods[query] 157 | elseif query == 'banhammer' then 158 | text = lang[ln].help.mods[query] 159 | elseif query == 'flood' then 160 | text = lang[ln].help.mods[query] 161 | elseif query == 'media' then 162 | text = lang[ln].help.mods[query] 163 | elseif query == 'welcome' then 164 | text = lang[ln].help.mods[query] 165 | elseif query == 'extra' then 166 | text = lang[ln].help.mods[query] 167 | elseif query == 'warns' then 168 | text = lang[ln].help.mods[query] 169 | elseif query == 'char' then 170 | text = lang[ln].help.mods[query] 171 | elseif query == 'links' then 172 | text = lang[ln].help.mods[query] 173 | elseif query == 'lang' then 174 | text = lang[ln].help.mods[query] 175 | elseif query == 'settings' then 176 | text = lang[ln].help.mods[query] 177 | end 178 | keyboard = make_keyboard(with_mods_lines, query) 179 | local res, code = api.editMessageText(msg.chat.id, msg.message_id, text, keyboard, true) 180 | if not res and code and code == 111 then 181 | api.answerCallbackQuery(msg.cb_id, '❗️ Already on this tab') 182 | elseif query ~= 'user' and query ~= 'mod' and query ~= 'info_button' then 183 | api.answerCallbackQuery(msg.cb_id, '💡 '..lang[ln].help.mods[query]:sub(1, string.find(lang[ln].help.mods[query], '\n')):mEscape_hard()) 184 | end 185 | end 186 | end 187 | 188 | return { 189 | action = action, 190 | admin_not_needed = true, 191 | triggers = { 192 | '^/(start)$', 193 | '^/(help)$', 194 | '^/(startme)$', 195 | '^###cb:!(user)', 196 | '^###cb:!(info_button)', 197 | '^###cb:!(mod)', 198 | '^###cb:!(info)', 199 | '^###cb:!(banhammer)', 200 | '^###cb:!(flood)', 201 | '^###cb:!(media)', 202 | '^###cb:!(links)', 203 | '^###cb:!(lang)', 204 | '^###cb:!(welcome)', 205 | '^###cb:!(extra)', 206 | '^###cb:!(warns)', 207 | '^###cb:!(char)', 208 | '^###cb:!(settings)', 209 | } 210 | } -------------------------------------------------------------------------------- /plugins/inline.lua: -------------------------------------------------------------------------------- 1 | local triggers = { 2 | '^/(inline)$' 3 | } 4 | 5 | local action = function(msg) 6 | local input = URL.escape(msg.text:input()) 7 | 8 | if input == 'emoji' then -- BETA test OFF NotSOON :/ 9 | local text = "["..inline_block('( ͡° ͜ʖ ͡°)', '( ͡° ͜ʖ ͡°)')..', ' 10 | text = text .. inline_block('ʘ‿ʘ', 'ʘ‿ʘ')..', ' 11 | text = text .. inline_block('(╯°□°)╯︵ ┻━┻', '(╯°□°)╯︵ ┻━┻')..', ' 12 | text = text .. inline_block('(ツ)_/¯', '(ツ)_/¯')..']' 13 | sendInline(msg.id, URL.escape(text)) 14 | else 15 | local text = "["..inline_block('Bold', '*'..input..'*')..', ' 16 | text = text .. inline_block('Italic', '_'..input..'_')..', ' 17 | text = text .. inline_block('Code', '```'..input..'```')..']' 18 | sendInline(msg.id, text) 19 | end 20 | end 21 | 22 | return { 23 | action = action, 24 | triggers = triggers 25 | } -------------------------------------------------------------------------------- /plugins/isbanned.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks) 2 | 3 | if blocks[1] == 'isbanned' then 4 | if not blocks[2] then 5 | if not msg.reply then 6 | api.sendReply(msg, '🔰Respondele a alguien para saber si está globalmente baneado (en grupos) y te enviaré el resultado por privado o consulta por privado adjuntando la ID: /isbanned (ID) por ejemplo: /isbanned 123456789') 7 | return 8 | else 9 | id = msg.reply.from.id 10 | end 11 | else 12 | id = blocks[2] 13 | end 14 | if msg.reply then 15 | local grep = io.popen("grep "..id.. " ./data/gbans") 16 | local list = grep:read("*a") 17 | end 18 | if blocks[2] then 19 | local grep = io.popen("grep -o "..blocks[2].. " ./data/gbans") 20 | local list = grep:read("*a") 21 | end 22 | if is_blocked_global(id) or list == "" then 23 | api.sendMessage(msg.from.id, '✅ Este usuario si esta globalmente banneado.') 24 | else 25 | api.sendMessage(msg.from.id, '❌❗️Este usuario no esta globalmente banneado. Si quieres reportarlo puedes hacerlo por privado a @Webrom o @Webrom2. Gracias.') 26 | end 27 | end 28 | 29 | end 30 | 31 | return { 32 | action = action, 33 | triggers = { 34 | '^/(isbanned)$', 35 | '^/(isbanned) (%d+)$' 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /plugins/italic.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, matches) 2 | if matches[1] == '_' then 3 | api.sendMessage(msg.chat.id, '_' ..matches[2].. '_', true) 4 | end 5 | if matches[1] == '*' then 6 | api.sendMessage(msg.chat.id, '*' ..matches[2].. '*', true) 7 | end 8 | end 9 | 10 | return { 11 | action = action, 12 | triggers = { 13 | "(.*)(*)(.*)(*)(.*)", 14 | "(.*)(_)(.*)(_)(.*)" 15 | } 16 | } -------------------------------------------------------------------------------- /plugins/killer.lua: -------------------------------------------------------------------------------- 1 | local triggers = { 2 | '^[Mm]ata a (.*)$', 3 | '^[Gg]arp mata a (.*)$' 4 | } 5 | 6 | local action = function(msg, matches, blocks, ln) 7 | 8 | api.sendMessage(msg.chat.id, '_Llamando a Terminator..._\n_Matando a ' ..matches[1]..'_...', true) 9 | api.sendVideo(msg.chat.id, './enviar/gif/giphy.mp4') 10 | 11 | 12 | end 13 | 14 | return { 15 | action = action, 16 | triggers = triggers 17 | } 18 | -------------------------------------------------------------------------------- /plugins/links.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks, ln) 2 | if msg.chat.type == 'private' then return end 3 | if not is_mod(msg) then return end 4 | 5 | local hash = 'chat:'..msg.chat.id..'links' 6 | local text 7 | 8 | if blocks[1] == 'link' then 9 | 10 | local key = 'link' 11 | local link = db:hget(hash, key) 12 | 13 | --check if link is nil or nul 14 | if link == 'no' or link == nil then 15 | text = lang[ln].links.no_link 16 | else 17 | local title = msg.chat.title:mEscape_hard() 18 | text = make_text(lang[ln].links.link, title, link) 19 | end 20 | api.sendReply(msg, text, true) 21 | end 22 | 23 | if blocks[1] == 'setlink' then 24 | 25 | local link 26 | if msg.chat.username then 27 | link = 'https://telegram.me/'..msg.chat.username 28 | else 29 | if not blocks[2] then 30 | api.sendReply(msg, lang[ln].links.link_no_input, true) 31 | return 32 | end 33 | --warn if the link has not the right lenght 34 | if string.len(blocks[2]) ~= 22 and blocks[2] ~= 'no' then 35 | api.sendReply(msg, lang[ln].links.link_invalid, true) 36 | return 37 | end 38 | link = 'https://telegram.me/joinchat/'..blocks[2] 39 | end 40 | 41 | local key = 'link' 42 | 43 | --set to nul the link, or update/set it 44 | if blocks[2] == 'no' then 45 | db:hset(hash, key, 'no') 46 | text = lang[ln].links.link_unsetted 47 | else 48 | local succ = db:hset(hash, key, link) 49 | local title = msg.chat.title:mEscape_hard() 50 | if succ == false then 51 | text = make_text(lang[ln].links.link_updated, title, link) 52 | else 53 | text = make_text(lang[ln].links.link_setted, title, link) 54 | end 55 | end 56 | api.sendReply(msg, text, true) 57 | end 58 | end 59 | 60 | return { 61 | action = action, 62 | triggers = { 63 | '^/(link)$', 64 | '^/(setlink)$', 65 | '^/(setlink) https://telegram%.me/joinchat/(.*)', 66 | '^/(setlink) (no)' 67 | } 68 | } -------------------------------------------------------------------------------- /plugins/mediasettings.lua: -------------------------------------------------------------------------------- 1 | local function get_group_name(text) 2 | local name = text:match('.*%((.+)%)$') 3 | if not name then 4 | return '' 5 | end 6 | name = '\n('..name..')' 7 | return name:mEscape() 8 | end 9 | 10 | local function doKeyboard_media(chat_id) 11 | local keyboard = {} 12 | keyboard.inline_keyboard = {} 13 | for i,media in pairs(config.media_list) do 14 | local status = (db:hget('chat:'..chat_id..':media', media)) or 'allowed' 15 | if status == 'allowed' then 16 | status = '✅' 17 | else 18 | status = '🔐 '..status 19 | end 20 | local line = { 21 | {text = media, callback_data = 'mediallert'}, 22 | {text = status, callback_data = 'media:'..media..':'..chat_id} 23 | } 24 | table.insert(keyboard.inline_keyboard, line) 25 | end 26 | 27 | --media warn 28 | local max = (db:hget('chat:'..chat_id..':warnsettings', 'mediamax')) or 2 29 | table.insert(keyboard.inline_keyboard, {{text = 'Warns (media) 📍 '..max, callback_data = 'mediallert'}}) 30 | local warn = { 31 | {text = '➖', callback_data = 'mediawarn:dim:'..chat_id}, 32 | {text = '➕', callback_data = 'mediawarn:raise:'..chat_id}, 33 | } 34 | table.insert(keyboard.inline_keyboard, warn) 35 | return keyboard 36 | end 37 | 38 | local action = function(msg, blocks, ln) 39 | 40 | if not msg.cb and msg.chat.type ~= 'private' then 41 | 42 | if not is_mod(msg) then return end 43 | 44 | if blocks[1] == 'media list' then 45 | local media_sett = db:hgetall('chat:'..msg.chat.id..':media') 46 | local text = lang[ln].mediasettings.settings_header 47 | for k,v in pairs(media_sett) do 48 | text = text..'`'..k..'`'..' ≡ '..v..'\n' 49 | end 50 | api.sendReply(msg, text, true) 51 | end 52 | if blocks[1] == 'media' then 53 | keyboard = doKeyboard_media(msg.chat.id) 54 | local res = api.sendKeyboard(msg.from.id, lang[ln].all.media_first..'\n('..msg.chat.title:mEscape()..')', keyboard, true) 55 | if res then 56 | api.sendMessage(msg.chat.id, lang[ln].bonus.general_pm, true) 57 | else 58 | cross.sendStartMe(msg, ln) 59 | end 60 | end 61 | end 62 | 63 | if msg.cb then 64 | if blocks[1] == 'mediallert' then 65 | api.answerCallbackQuery(msg.cb_id, '⚠️ '..lang[ln].bonus.menu_cb_media) 66 | return 67 | end 68 | local cb_text 69 | local group_name = get_group_name(msg.old_text) 70 | local chat_id = msg.target_id 71 | if blocks[1] == 'mediawarn' then 72 | local current = tonumber(db:hget('chat:'..chat_id..':warnsettings', 'mediamax')) or 2 73 | if blocks[2] == 'dim' then 74 | if current < 2 then 75 | cb_text = lang[ln].warn.inline_low 76 | else 77 | local new = db:hincrby('chat:'..chat_id..':warnsettings', 'mediamax', -1) 78 | cb_text = make_text(lang[ln].floodmanager.changed_cross, current, new) 79 | end 80 | elseif blocks[2] == 'raise' then 81 | if current > 11 then 82 | cb_text = lang[ln].warn.inline_high 83 | else 84 | local new = db:hincrby('chat:'..chat_id..':warnsettings', 'mediamax', 1) 85 | cb_text = make_text(lang[ln].floodmanager.changed_cross, current, new) 86 | end 87 | end 88 | cb_text = '⚙ '..cb_text 89 | end 90 | if blocks[1] == 'media' then 91 | local media = blocks[2] 92 | cb_text = '⚡️ '..cross.changeMediaStatus(chat_id, media, 'next', ln) 93 | end 94 | keyboard = doKeyboard_media(chat_id) 95 | api.editMessageText(msg.chat.id, msg.message_id, lang[ln].all.media_first..group_name, keyboard, true) 96 | api.answerCallbackQuery(msg.cb_id, cb_text) 97 | end 98 | end 99 | 100 | return { 101 | action = action, 102 | triggers = { 103 | '^/(media list)$', 104 | '^/(media)$', 105 | '^###cb:(media):(%a+):(-%d+)', 106 | '^###cb:(mediawarn):(%a+):(-%d+)', 107 | '^###cb:(mediallert)', 108 | } 109 | } -------------------------------------------------------------------------------- /plugins/multipurpose/commit.lua: -------------------------------------------------------------------------------- 1 | --from https://github.com/topkecleon/otouto/blob/26c1299374af130bbf8457af904cb4ea450caa51/plugins/commit.lua 2 | 3 | local commits = { 4 | "One does not simply merge into master", 5 | "Merging the merge", 6 | "Another bug bites the dust", 7 | "de-misunderestimating", 8 | "Some shit.", 9 | "add actual words", 10 | "I CAN HAZ COMMENTZ.", 11 | "giggle.", 12 | "Whatever.", 13 | "Finished fondling.", 14 | "FONDLED THE CODE", 15 | "this is how we generate our shit.", 16 | "unh", 17 | "It works!", 18 | "unionfind is no longer being molested.", 19 | "Well, it's doing something.", 20 | "I'M PUSHING.", 21 | "Whee.", 22 | "Whee, good night.", 23 | "It'd be nice if type errors caused the compiler to issue a type error", 24 | "Fucking templates.", 25 | "I hate this fucking language.", 26 | "marks", 27 | "that coulda been bad", 28 | "hoo boy", 29 | "It was the best of times, it was the worst of times", 30 | "Fucking egotistical bastard. adds expandtab to vimrc", 31 | "if you're not using et, fuck off", 32 | "WHO THE FUCK CAME UP WITH MAKE?", 33 | "This is a basic implementation that works.", 34 | "By works, I meant 'doesnt work'. Works now..", 35 | "Last time I said it works? I was kidding. Try this.", 36 | "Just stop reading these for a while, ok..", 37 | "Give me a break, it's 2am. But it works now.", 38 | "Make that it works in 90% of the cases. 3:30.", 39 | "Ok, 5am, it works. For real.", 40 | "FOR REAL.", 41 | "I don't know what these changes are supposed to accomplish but somebody told me to make them.", 42 | "I don't get paid enough for this shit.", 43 | "fix some fucking errors", 44 | "first blush", 45 | "So my boss wanted this button ...", 46 | "uhhhhhh", 47 | "forgot we're not using a smart language", 48 | "include shit", 49 | "To those I leave behind, good luck!", 50 | "things occurred", 51 | "i dunno, maybe this works", 52 | "8==========D", 53 | "No changes made", 54 | "whooooooooooooooooooooooooooo", 55 | "clarify further the brokenness of C++. why the fuck are we using C++?", 56 | ".", 57 | "Friday 5pm", 58 | "changes", 59 | "A fix I believe, not like I tested or anything", 60 | "Useful text", 61 | "pgsql is being a pain", 62 | "pgsql is more strict, increase the hackiness up to 11", 63 | "c&p fail", 64 | "syntax", 65 | "fix", 66 | "just shoot me", 67 | "arrrggghhhhh fixed!", 68 | "someone fails and it isn't me", 69 | "totally more readable", 70 | "better grepping", 71 | "fix", 72 | "fix bug, for realz", 73 | "fix /sigh", 74 | "Does this work", 75 | "MOAR BIFURCATION", 76 | "bifurcation", 77 | "REALLY FUCKING FIXED", 78 | "FIX", 79 | "better ignores", 80 | "More ignore", 81 | "more ignores", 82 | "more ignores", 83 | "more ignores", 84 | "more ignores", 85 | "more ignores", 86 | "more ignored words", 87 | "more fixes", 88 | "really ignore ignored worsd", 89 | "fixes", 90 | "/sigh", 91 | "fix", 92 | "fail", 93 | "pointless limitation", 94 | "omg what have I done?", 95 | "added super-widget 2.0.", 96 | "tagging release w.t.f.", 97 | "I can't believe it took so long to fix this.", 98 | "I must have been drunk.", 99 | "This is why the cat shouldn't sit on my keyboard.", 100 | "This is why git rebase is a horrible horrible thing.", 101 | "ajax-loader hotness, oh yeah", 102 | "small is a real HTML tag, who knew.", 103 | "WTF is this.", 104 | "Do things better, faster, stronger", 105 | "Use a real JS construct, WTF knows why this works in chromium.", 106 | "Added a banner to the default admin page. Please have mercy on me =(", 107 | "needs more cow bell", 108 | "Switched off unit test X because the build had to go out now and there was no time to fix it properly.", 109 | "Updated", 110 | "I must sleep... it's working... in just three hours...", 111 | "I was wrong...", 112 | "Completed with no bugs...", 113 | "Fixed a little bug...", 114 | "Fixed a bug in NoteLineCount... not seriously...", 115 | "woa!! this one was really HARD!", 116 | "Made it to compile...", 117 | "changed things...", 118 | "touched...", 119 | "i think i fixed a bug...", 120 | "perfect...", 121 | "Moved something to somewhere... goodnight...", 122 | "oops, forgot to add the file", 123 | "Corrected mistakes", 124 | "oops", 125 | "oops!", 126 | "put code that worked where the code that didn't used to be", 127 | "Nothing to see here, move along", 128 | "I am even stupider than I thought", 129 | "I don't know what the hell I was thinking.", 130 | "fixed errors in the previous commit", 131 | "Committed some changes", 132 | "Some bugs fixed", 133 | "Minor updates", 134 | "Added missing file in previous commit", 135 | "bug fix", 136 | "typo", 137 | "bara bra grejjor", 138 | "Continued development...", 139 | "Does anyone read this? I'll be at the coffee shop accross the street.", 140 | "That's just how I roll", 141 | "work in progress", 142 | "minor changes", 143 | "some brief changes", 144 | "assorted changes", 145 | "lots and lots of changes", 146 | "another big bag of changes", 147 | "lots of changes after a lot of time", 148 | "LOTS of changes. period", 149 | "Test commit. Please ignore", 150 | "I'm just a grunt. Don't blame me for this awful PoS.", 151 | "I did it for the lulz!", 152 | "I'll explain this when I'm sober .. or revert it", 153 | "Obligatory placeholder commit message", 154 | "A long time ago, in a galaxy far far away...", 155 | "Fixed the build.", 156 | "various changes", 157 | "One more time, but with feeling.", 158 | "Handled a particular error.", 159 | "Fixed unnecessary bug.", 160 | "Removed code.", 161 | "Added translation.", 162 | "Updated build targets.", 163 | "Refactored configuration.", 164 | "Locating the required gigapixels to render...", 165 | "Spinning up the hamster...", 166 | "Shovelling coal into the server...", 167 | "Programming the flux capacitor", 168 | "The last time I tried this the monkey didn't survive. Let's hope it works better this time.", 169 | "I should have had a V8 this morning.", 170 | "640K ought to be enough for anybody", 171 | "pay no attention to the man behind the curtain", 172 | "a few bits tried to escape, but we caught them", 173 | "Who has two thumbs and remembers the rudiments of his linear algebra courses? Apparently, this guy.", 174 | "workaround for ant being a pile of fail", 175 | "Don't push this commit", 176 | "rats", 177 | "squash me", 178 | "fixed mistaken bug", 179 | "Final commit, ready for tagging", 180 | "-m \'So I hear you like commits ...\'", 181 | "epic", 182 | "need another beer", 183 | "Well the book was obviously wrong.", 184 | "lolwhat?", 185 | "Another commit to keep my CAN streak going.", 186 | "I cannot believe that it took this long to write a test for this.", 187 | "TDD: 1, Me: 0", 188 | "Yes, I was being sarcastic.", 189 | "Apparently works-for-me is a crappy excuse.", 190 | "tl;dr", 191 | "I would rather be playing SC2.", 192 | "Crap. Tonight is raid night and I am already late.", 193 | "I know what I am doing. Trust me.", 194 | "You should have trusted me.", 195 | "Is there an award for this?", 196 | "Is there an achievement for this?", 197 | "I'm totally adding this to epic win. +300", 198 | "This really should not take 19 minutes to build.", 199 | "fixed the israeli-palestinian conflict", 200 | "SHIT ===> GOLD", 201 | "Committing in accordance with the prophecy.", 202 | "It compiles! Ship it!", 203 | "LOL!", 204 | "Reticulating splines...", 205 | "SEXY RUSSIAN CODES WAITING FOR YOU TO CALL", 206 | "s/import/include/", 207 | "extra debug for stuff module", 208 | "debug line test", 209 | "debugo", 210 | "remove debug
all good", 211 | "debug suff", 212 | "more debug... who overwrote!", 213 | "these confounded tests drive me nuts", 214 | "For great justice.", 215 | "QuickFix.", 216 | "oops - thought I got that one.", 217 | "removed echo and die statements, lolz.", 218 | "somebody keeps erasing my changes.", 219 | "doh.", 220 | "pam anderson is going to love me.", 221 | "added security.", 222 | "arrgghh... damn this thing for not working.", 223 | "jobs... steve jobs", 224 | "and a comma", 225 | "this is my quickfix branch and i will use to do my quickfixes", 226 | "Fix my stupidness", 227 | "and so the crazy refactoring process sees the sunlight after some months in the dark!", 228 | "gave up and used tables.", 229 | "[Insert your commit message here. Be sure to make it descriptive.]", 230 | "Removed test case since code didn't pass QA", 231 | "removed tests since i can't make them green", 232 | "stuff", 233 | "more stuff", 234 | "Become a programmer, they said. It'll be fun, they said.", 235 | "Same as last commit with changes", 236 | "foo", 237 | "just checking if git is working properly...", 238 | "fixed some minor stuff, might need some additional work.", 239 | "just trolling the repo", 240 | "All your codebase are belong to us.", 241 | "Somebody set up us the bomb.", 242 | "should work I guess...", 243 | "To be honest, I do not quite remember everything I changed here today. But it is all good, I tell ya.", 244 | "well crap.", 245 | "herpderp (redux)", 246 | "herpderp", 247 | "Derp", 248 | "derpherp", 249 | "Herping the derp", 250 | "sometimes you just herp the derp so hard it herpderps", 251 | "Derp. Fix missing constant post rename", 252 | "Herping the fucking derp right here and now.", 253 | "Derp, asset redirection in dev mode", 254 | "mergederp", 255 | "Derp search/replace fuckup", 256 | "Herpy dooves.", 257 | "Derpy hooves", 258 | "derp, helper method rename", 259 | "Herping the derp derp (silly scoping error)", 260 | "Herp derp I left the debug in there and forgot to reset errors.", 261 | "Reset error count between rows. herpderp", 262 | "hey, what's that over there?!", 263 | "hey, look over there!", 264 | "It worked for me...", 265 | "Does not work.", 266 | "Either Hot Shit or Total Bollocks", 267 | "Arrrrgggg", 268 | "Don’t mess with Voodoo", 269 | "I expected something different.", 270 | "Todo!!!", 271 | "This is supposed to crash", 272 | "No changes after this point.", 273 | "I know, I know, this is not how I’m supposed to do it, but I can't think of something better.", 274 | "Don’t even try to refactor it.", 275 | "(c) Microsoft 1988", 276 | "Please no changes this time.", 277 | "Why The Fuck?", 278 | "We should delete this crap before shipping.", 279 | "Shit code!", 280 | "ALL SORTS OF THINGS", 281 | "Herpderp, shoulda check if it does really compile.", 282 | "I CAN HAZ PYTHON, I CAN HAZ INDENTS", 283 | "Major fixup.", 284 | "less french words", 285 | "breathe, =, breathe", 286 | "IEize", 287 | "this doesn't really make things faster, but I tried", 288 | "this should fix it", 289 | "forgot to save that file", 290 | "Glue. Match sticks. Paper. Build script!", 291 | "Argh! About to give up :(", 292 | "Blaming regex.", 293 | "oops", 294 | "it's friday", 295 | "yo recipes", 296 | "Not sure why", 297 | "lol digg", 298 | "grrrr", 299 | "For real, this time.", 300 | "Feed. You. Stuff. No time.", 301 | "I don't give a damn 'bout my reputation", 302 | "DEAL WITH IT", 303 | "commit", 304 | "tunning", 305 | "I really should've committed this when I finished it...", 306 | "It's getting hard to keep up with the crap I've trashed", 307 | "I honestly wish I could remember what was going on here...", 308 | "I must enjoy torturing myself", 309 | "For the sake of my sanity, just ignore this...", 310 | "That last commit message about silly mistakes pales in comparision to this one", 311 | "My bad", 312 | "Still can't get this right...", 313 | "Nitpicking about alphabetizing methods, minor OCD thing", 314 | "Committing fixes in the dark, seriously, who killed my power!?", 315 | "You can't see it, but I'm making a very angry face right now", 316 | "Fix the fixes", 317 | "It's secret!", 318 | "Commit committed....", 319 | "No time to commit.. My people need me!", 320 | "Something fixed", 321 | "I'm hungry", 322 | "asdfasdfasdfasdfasdfasdfadsf", 323 | "hmmm", 324 | "formatted all", 325 | "Replace all whitespaces with tabs.", 326 | "s/ / /g", 327 | "I'm too foo for this bar", 328 | "Things went wrong...", 329 | "??! what the ...", 330 | "This solves it.", 331 | "Working on tests (haha)", 332 | "fixed conflicts (LOL merge -s ours; push -f)", 333 | "last minute fixes.", 334 | "fuckup.", 335 | "Revert \"fuckup\".", 336 | "should work now.", 337 | "final commit.", 338 | "done. going to bed now.", 339 | "buenas those-things.", 340 | "Your commit is writing checks your merge can't cash.", 341 | "This branch is so dirty, even your mom can't clean it.", 342 | "wip", 343 | "Revert \"just testing, remember to revert\"", 344 | "bla", 345 | "harharhar", 346 | "restored deleted entities just to be sure", 347 | "added some filthy stuff", 348 | "bugger", 349 | "lol", 350 | "oopsie B|", 351 | "Copy pasta fail. still had a instead of a", 352 | "Now added delete for real", 353 | "grmbl", 354 | "move your body every every body", 355 | "Trying to fake a conflict", 356 | "And a commit that I don't know the reason of...", 357 | "ffs", 358 | "that's all folks", 359 | "Fucking submodule bull shit", 360 | "apparently i did something…", 361 | "bump to 0.0.3-dev:wq", 362 | "pep8 - cause I fell like doing a barrel roll", 363 | "pep8 fixer", 364 | "it is hump day _^_", 365 | "happy monday _ bleh _", 366 | "after of this commit remember do a git reset hard", 367 | "someday I gonna kill someone for this shit...", 368 | "magic, have no clue but it works", 369 | "I am sorry", 370 | "dirty hack, have a better idea ?", 371 | "Code was clean until manager requested to fuck it up", 372 | " - Temporary commit.", 373 | ":(:(", 374 | "...", 375 | "GIT :/", 376 | "stopped caring 10 commits ago", 377 | "Testing in progress ;)", 378 | "Fixed Bug", 379 | "Fixed errors", 380 | "Push poorly written test can down the road another ten years", 381 | "commented out failing tests", 382 | "I'm human", 383 | "TODO: write meaningful commit message", 384 | "Pig", 385 | "SOAP is a piece of shit", 386 | "did everything", 387 | "project lead is allergic to changes...", 388 | "making this thing actually usable.", 389 | "I was told to leave it alone, but I have this thing called OCD, you see", 390 | "Whatever will be, will be 8{", 391 | "It's 2015; why are we using ColdFusion?!", 392 | "#GrammarNazi", 393 | "Future self, please forgive me and don't hit me with the baseball bat again!", 394 | "Hide those navs, boi!", 395 | "Who knows...", 396 | "Who knows WTF?!", 397 | "I should get a raise for this.", 398 | "Done, to whoever merges this, good luck.", 399 | "Not one conflict, today was a good day.", 400 | "First Blood", 401 | "Fixed the fuck out of #526!", 402 | "I'm too old for this shit!", 403 | "One little whitespace gets its very own commit! Oh, life is so erratic!" 404 | } 405 | 406 | local action = function(msg) 407 | if msg.chat.type ~= 'private' and is_admin_cached(msg) then 408 | api.sendMessage(msg.chat.id, '`'..commits[math.random(#commits)]..'`', true) 409 | end 410 | end 411 | 412 | return { 413 | action = action, 414 | triggers = { 415 | config.cmd..'commits?$' 416 | } 417 | } 418 | -------------------------------------------------------------------------------- /plugins/multipurpose/eightball.lua: -------------------------------------------------------------------------------- 1 | --from https://github.com/topkecleon/otouto/blob/26c1299374af130bbf8457af904cb4ea450caa51/plugins/eightball.lua 2 | 3 | local ball_answers = { 4 | "It is certain.", 5 | "It is decidedly so.", 6 | "Without a doubt.", 7 | "Yes, definitely.", 8 | "You may rely on it.", 9 | "As I see it, yes.", 10 | "Most likely.", 11 | "Outlook: good.", 12 | "Yes.", 13 | "Signs point to yes.", 14 | "Reply hazy try again.", 15 | "Ask again later.", 16 | "Better not tell you now.", 17 | "Cannot predict now.", 18 | "Concentrate and ask again.", 19 | "Don't count on it.", 20 | "My reply is no.", 21 | "My sources say no.", 22 | "Outlook: not so good.", 23 | "Very doubtful.", 24 | "There is a time and place for everything, but not now." 25 | } 26 | 27 | local yesno_answers = { 28 | 'Absolutely.', 29 | 'In your dreams.', 30 | 'No please.', 31 | 'Go for it.', 32 | 'Yes.', 33 | 'No.' 34 | } 35 | 36 | local action = function(msg) 37 | if msg.chat.type ~= 'private' and is_admin_cached(msg) then 38 | if msg.reply then 39 | msg = msg.reply 40 | end 41 | 42 | local message 43 | 44 | if msg.text:lower():match('y/n%p?$') then 45 | message = yesno_answers[math.random(#yesno_answers)] 46 | else 47 | message = ball_answers[math.random(#ball_answers)] 48 | end 49 | 50 | api.sendReply(msg, message) 51 | end 52 | end 53 | 54 | return { 55 | action = action, 56 | triggers = { 57 | config.cmd..'8ball', 58 | 'y/n%p?$' 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /plugins/onmessage.lua: -------------------------------------------------------------------------------- 1 | local function max_reached(chat_id, user_id) 2 | local max = tonumber(db:hget('chat:'..chat_id..':warnsettings', 'mediamax')) or 2 3 | local n = tonumber(db:hincrby('chat:'..chat_id..':mediawarn', user_id, 1)) 4 | if n >= max then 5 | return true, n, max 6 | else 7 | return false, n, max 8 | end 9 | end 10 | 11 | local function is_ignored(chat_id, msg_type) 12 | local hash = 'chat:'..chat_id..':floodexceptions' 13 | local status = (db:hget(hash, msg_type)) or 'no' 14 | if status == 'yes' then 15 | return true 16 | elseif status == 'no' then 17 | return false 18 | end 19 | end 20 | 21 | local function is_blocked_global(id) 22 | if db:sismember('bot:blocked', id) then 23 | return true 24 | else 25 | return false 26 | end 27 | end 28 | 29 | 30 | pre_process = function(msg, ln) 31 | if msg.from.id and is_blocked_global(msg.from.id) then 32 | print('Bloqueado y Baneado:', msg.from.id) 33 | api.kickChatMember(msg.chat.id, msg.from.id) 34 | return msg, true --if an user is blocked, don't go through plugins 35 | end 36 | --db:hget('bot:general', 'spam') == 'on' and 37 | -- if msg.from.id and is_kick_spammer(msg.text) then 38 | -- local iduser = msg.from.id 39 | -- local name = msg.from.first_name 40 | -- if msg.from.username then name = name..' (@'..msg.from.username..')' end 41 | -- local message = make_text(lang[ln].preprocess.arab_kicked, name:mEscape()) 42 | -- api.sendMessage(msg.chat.id, '\n\n_ID Del Usuario_: ' ..iduser.. '\n_Nombre_: ' ..name.. ' *Ha sido expulsado por publicar links de invitaciones de otros grupos y/o hacer tag de algún canal.* \n_Si eres Admin ignora el mensaje._ *No olviden leer las reglas, para asi evitar recibir un ban definitivo.* ', true) 43 | -- api.kickChatMember(msg.chat.id, msg.from.id) 44 | -- return msg, true 45 | -- end 46 | local msg_type = 'text' 47 | if msg.media then msg_type = msg.text:gsub('###', '') end 48 | if not is_ignored(msg.chat.id, msg_type) then 49 | local spamhash = 'spam:'..msg.chat.id..':'..msg.from.id 50 | local msgs = tonumber(db:get(spamhash)) or 0 51 | if msgs == 0 then msgs = 1 end 52 | local default_spam_value = 5 53 | if msg.chat.type == 'private' then default_spam_value = 12 end 54 | local max_msgs = tonumber(db:hget('chat:'..msg.chat.id..':flood', 'MaxFlood')) or default_spam_value 55 | if msg.cb then max_msgs = 15 end 56 | local max_time = 5 57 | db:setex(spamhash, max_time, msgs+1) 58 | if msgs > max_msgs then 59 | local status = db:hget('chat:'..msg.chat.id..':settings', 'Flood') or 'yes' 60 | --how flood on/off works: yes->yes, antiflood is diabled. no->no, anti flood is not disbaled 61 | if status == 'no' and not msg.cb then 62 | local action = db:hget('chat:'..msg.chat.id..':flood', 'ActionFlood') 63 | local name = msg.from.first_name 64 | if msg.from.username then name = name..' (@'..msg.from.username..')' end 65 | local is_normal_group = false 66 | local res, message 67 | --try to kick or ban 68 | if action == 'ban' then 69 | if msg.chat.type == 'group' then is_normal_group = true end 70 | res = api.banUser(msg.chat.id, msg.from.id, is_normal_group, ln) 71 | else 72 | res = api.kickUser(msg.chat.id, msg.from.id, ln) 73 | end 74 | --if kicked/banned, send a message 75 | if res then 76 | cross.saveBan(msg.from.id, 'flood') --save ban 77 | if action == 'ban' then 78 | cross.addBanList(msg.chat.id, msg.from.id, name, lang[ln].preprocess.flood_motivation) 79 | message = make_text(lang[ln].preprocess.flood_ban, name:mEscape()) 80 | else 81 | message = make_text(lang[ln].preprocess.flood_kick, name:mEscape()) 82 | end 83 | if msgs == (max_msgs + 1) or msgs == max_msgs + 5 then --send the message only if it's the message after the first message flood. Repeat after 5 84 | api.sendMessage(msg.chat.id, message, true) 85 | end 86 | end 87 | end 88 | 89 | if msg.cb then 90 | api.answerCallbackQuery(msg.cb_id, '‼️ Please don\'t abuse the keyboard, requests will be ignored') 91 | end 92 | return msg, true --if an user is spamming, don't go through plugins 93 | end 94 | end 95 | if msg.media and not(msg.chat.type == 'private') and not msg.cb then 96 | if is_mod(msg) then return msg end 97 | local name = msg.from.first_name 98 | if msg.from.username then name = name..' (@'..msg.from.username..')' end 99 | local media = msg.text:gsub('###', '') 100 | if msg.url then media = 'link' end 101 | local hash = 'chat:'..msg.chat.id..':media' 102 | local status = db:hget(hash, media) 103 | local out 104 | if not(status == 'allowed') then 105 | local max_reached_var, n, max = max_reached(msg.chat.id, msg.from.id) 106 | if max_reached_var then --max num reached. Kick/ban the user 107 | --try to kick/ban 108 | if status == 'kick' then 109 | res = api.kickUser(msg.chat.id, msg.from.id, ln) 110 | elseif status == 'ban' then 111 | if msg.chat.type == 'group' then is_normal_group = true end 112 | res = api.banUser(msg.chat.id, msg.from.id, is_normal_group, ln) 113 | end 114 | if res then --kick worked 115 | cross.saveBan(msg.from.id, 'media') --save ban 116 | db:hdel('chat:'..msg.chat.id..':mediawarn', msg.from.id) --remove media warns 117 | local message 118 | if status == 'ban' then 119 | cross.addBanList(msg.chat.id, msg.from.id, name, lang[ln].preprocess.media_motivation) 120 | message = make_text(lang[ln].preprocess.media_ban, name:mEscape())..'\n`('..n..'/'..max..')`' 121 | else 122 | message = make_text(lang[ln].preprocess.media_kick, name:mEscape())..'\n`('..n..'/'..max..')`' 123 | end 124 | api.sendMessage(msg.chat.id, message, true) 125 | end 126 | else --max num not reached -> warn 127 | local message = lang[ln].preprocess.first_warn..'\n*('..n..'/'..max..')*' 128 | api.sendReply(msg, message, true) 129 | end 130 | end 131 | end 132 | 133 | local rtl_status = (db:hget('chat:'..msg.chat.id..':char', 'Rtl')) or 'allowed' 134 | if rtl_status == 'kick' or rtl_status == 'ban' then 135 | local name = msg.from.first_name 136 | if msg.from.username then name = name..' (@'..msg.from.username..')' end 137 | local rtl = '‮' 138 | local last_name = 'x' 139 | if msg.from.last_name then last_name = msg.from.last_name end 140 | local check = msg.text:find(rtl..'+') or msg.from.first_name:find(rtl..'+') or last_name:find(rtl..'+') 141 | if check ~= nil then 142 | local res 143 | if rtl_status == 'kick' then 144 | res = api.kickUser(msg.chat.id, msg.from.id, ln) 145 | elseif status == 'ban' then 146 | res = api.banUser(msg.chat.id, msg.from.id, msg.normal_group, ln) 147 | end 148 | if res then 149 | cross.saveBan(msg.from.id, 'rtl') --save ban 150 | local message = make_text(lang[ln].preprocess.rtl_kicked, name:mEscape()) 151 | if rtl_status == 'ban' then 152 | cross.addBanList(msg.chat.id, msg.from.id, name, 'Rtl') 153 | message = make_text(lang[ln].preprocess.rtl_banned, name:mEscape()) 154 | end 155 | api.sendMessage(msg.chat.id, message, true) 156 | end 157 | end 158 | end 159 | 160 | if msg.text and msg.text:find('([\216-\219][\128-\191])') then 161 | local arab_status = (db:hget('chat:'..msg.chat.id..':char', 'Arab')) or 'allowed' 162 | if arab_status == 'kick' or arab_status == 'ban' then 163 | local name = msg.from.first_name 164 | if msg.from.username then name = name..' (@'..msg.from.username..')' end 165 | local res 166 | if arab_status == 'kick' then 167 | res = api.kickUser(msg.chat.id, msg.from.id, ln) 168 | elseif arab_status == 'ban' then 169 | res = api.banUser(msg.chat.id, msg.from.id, msg.normal_group, ln) 170 | end 171 | if res then 172 | cross.saveBan(msg.from.id, 'arab') --save ban 173 | local message = make_text(lang[ln].preprocess.arab_kicked, name:mEscape()) 174 | if arab_status == 'ban' then 175 | cross.addBanList(msg.chat.id, msg.from.id, name, 'Arab') 176 | message = make_text(lang[ln].preprocess.arab_banned, name:mEscape()) 177 | end 178 | api.sendMessage(msg.chat.id, message, true) 179 | end 180 | end 181 | end 182 | 183 | --[[ local spamhash = 'spam:'..msg.chat.id..':'..msg.from.id 184 | local msgs = tonumber(db:get(spamhash)) or 0 185 | if msgs == 0 then msgs = 1 end 186 | local default_spam_value = 2 187 | if msg.chat.type == 'private' then default_spam_value = 3 end 188 | local max_msgs = tonumber(db:hget('chat:'..msg.chat.id..':flood', 'MaxFlood')) or default_spam_value 189 | if msg.cb then max_msgs = 3 end 190 | local max_time = 5 191 | db:setex(spamhash, max_time, msgs+1) 192 | if msgs > max_msgs then]] 193 | 194 | -- local spam_status = or 'allowed' 195 | -- print('\n\n_ID Del Usuario_: ' ..iduser.. '\n_Nombre_: ' ..name.. ' *Ha sido expulsado por publicar links de invitaciones de otros grupos y/o hacer tag de algún canal.* \n_Si eres Admin ignora el mensaje._ *No olviden leer las reglas, para asi evitar recibir un ban definitivo.* ', msg.chat.id) 196 | -- api.sendMessage(msg.chat.id, '\n\n_ID Del Usuario_: ' ..iduser.. '\n_Nombre_: ' ..name.. ' *Ha sido expulsado por publicar links de invitaciones de otros grupos y/o hacer tag de algún canal.* \n_Si eres Admin ignora el mensaje._ *No olviden leer las reglas, para asi evitar recibir un ban definitivo.*', true) 197 | -- return msg, true 198 | --end 199 | 200 | -- if is_blocked(msg.from.id) then --ignore blocked users 201 | -- api.kickChatMember(msg.chat.id, msg.from.id) 202 | -- return msg, true --if an user is blocked, don't go through plugins 203 | -- end 204 | 205 | return msg 206 | end 207 | 208 | return { 209 | on_each_msg = pre_process 210 | } 211 | -------------------------------------------------------------------------------- /plugins/plugins.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks) 2 | 3 | if not(msg.chat.type == 'private') and is_owner(msg) then 4 | 5 | if blocks[1] == "plugins" then 6 | if not blocks[2] then 7 | api.sendMessage(msg.chat.id, "*Plugins activados*\n"..load_plugins(), true) 8 | end 9 | 10 | if blocks[2] == "enable" then 11 | enabled = enable_plugin(msg, blocks) 12 | if enabled == true then 13 | api.sendReply(msg, "✅ Plugin _"..blocks[3]..".lua_ *activado* exitosamente.", true) 14 | bot_init(true) 15 | else 16 | api.sendReply(msg, "❌ El plugin _"..blocks[3]..".lua_ *ya fué activado* anteriormente ó *posiblemente no existe*.", true) 17 | end 18 | end 19 | 20 | if blocks[2] == "disable" then 21 | disabled = disable_plugin(msg, blocks) 22 | if disabled == true then 23 | api.sendReply(msg, "✅ Plugin _"..blocks[3]..".lua_ *desactivado* exitosamente.", true) 24 | bot_init(true) 25 | else 26 | api.sendReply(msg, "❌ El plugin _"..blocks[3]..".lua_ *ya fué desactivado* anteriormente.", true) 27 | end 28 | end 29 | end 30 | else 31 | api.sendMessage(msg.chat.id, "🚫 Para realizar esta opción *requieres permisos de creador*.", true) 32 | end 33 | end 34 | 35 | return { 36 | action = action, 37 | triggers = { 38 | '^/(plugins)$', 39 | '^/(plugins) (enable) (.+)', 40 | '^/(plugins) (disable) (.+)' 41 | } 42 | } -------------------------------------------------------------------------------- /plugins/private.lua: -------------------------------------------------------------------------------- 1 | local function do_keybaord_credits() 2 | local keyboard = {} 3 | keyboard.inline_keyboard = { 4 | { 5 | {text = 'Canal', url = 'https://telegram.me/'..config.channel:gsub('@', '')}, 6 | {text = 'GitHub', url = 'https://github.com/'}, 7 | {text = 'Evalúame!', url = 'https://telegram.me/storebot?start='..bot.username}, 8 | } 9 | } 10 | return keyboard 11 | end 12 | 13 | local action = function(msg, blocks, ln) 14 | 15 | if not(msg.chat.type == 'private') then return end 16 | 17 | if blocks[1] == 'ping' then 18 | api.sendMessage(msg.from.id, '*Pong!*', true) 19 | end 20 | if blocks[1] == 'strings' then 21 | if not blocks[2] then 22 | local file_id = db:get('trfile:EN') 23 | if not file_id then return end 24 | api.sendDocumentId(msg.chat.id, file_id, msg.message_id) 25 | else 26 | local l_code = blocks[2] 27 | local exists = is_lang_supported(l_code) 28 | if exists then 29 | local file_id = db:get('trfile:'..l_code:upper()) 30 | if not file_id then return end 31 | api.sendDocumentId(msg.chat.id, file_id, msg.message_id) 32 | else 33 | api.sendReply(msg, lang[ln].setlang.error, true) 34 | end 35 | end 36 | end 37 | if blocks[1] == 'echo' then 38 | local res, code = api.sendMessage(msg.chat.id, blocks[2], true) 39 | if not res then 40 | if code == 118 then 41 | api.sendMessage(msg.chat.id, lang[ln].bonus.too_long) 42 | else 43 | api.sendMessage(msg.chat.id, lang[ln].breaks_markdown, true) 44 | end 45 | end 46 | end 47 | if blocks[1] == 'c' then 48 | if msg.chat.type ~= 'private' then 49 | return 50 | end 51 | local text = 'This command *has been replaced!*\n\nNow you can start your message with an ! to communicate with the bot owner. Example:\n_!hello, how are you?_' 52 | if config.help_group and config.help_group ~= '' then 53 | text = text..'\n\nYou can also join the discussion group to ask your question/report a bug. You can join with [this link]('..config.help_group..')' 54 | end 55 | api.sendMessage(msg.chat.id, text, true) 56 | end 57 | if blocks[1] == '!' then 58 | if msg.chat.type ~= 'private' then 59 | return 60 | end 61 | local input = blocks[2] 62 | local receiver = msg.from.id 63 | 64 | --allert if not feedback 65 | if not input and not msg.reply then 66 | api.sendMessage(msg.from.id, lang[ln].report.no_input) 67 | return 68 | end 69 | 70 | if msg.reply then 71 | msg = msg.reply 72 | end 73 | 74 | api.forwardMessage (config.admin.owner, msg.from.id, msg.message_id) 75 | api.sendMessage(receiver, lang[ln].report.sent) 76 | end 77 | if blocks[1] == 'info' then 78 | local keyboard = {} 79 | keyboard = do_keybaord_credits() 80 | api.sendKeyboard(msg.chat.id, '`v'..config.version..'`\n'..lang[ln].credits, keyboard, true) 81 | end 82 | if blocks[1] == 'resolve' then 83 | local id = res_user_group(blocks[2], msg.chat.id) 84 | if not id then 85 | message = lang[ln].bonus.no_user 86 | else 87 | message = '*'..id..'*' 88 | end 89 | api.sendMessage(msg.chat.id, message, true) 90 | end 91 | end 92 | 93 | return { 94 | action = action, 95 | triggers = { 96 | '^/(ping)$', 97 | '^/(strings)$', 98 | '^/(strings) (%a%a)$', 99 | '^/(echo) (.*)$', 100 | -- '^/(c)%s?', 101 | '^(!)$', 102 | '^(!)(.+)', 103 | '^/(info)$', 104 | '^/(resolve) (@[%w_]+)$', 105 | } 106 | } -------------------------------------------------------------------------------- /plugins/publi.lua: -------------------------------------------------------------------------------- 1 | local function do_keyboard_public() 2 | local keyboard = {} 3 | keyboard.inline_keyboard = { 4 | { 5 | {text = '👥 Agregame a tu grupo', url = 'https://telegram.me/'..bot.username..'?startgroup=new'}, 6 | {text = '👥 Agrega al bot de soporte a tu grupo', url = 'https://telegram.me/GroupButlerEspSupp_bot?startgroup=new'}, 7 | }, 8 | { 9 | {text = '📢 Canal de ayuda', url = 'https://telegram.me/'..config.channel:gsub('@', '')}, 10 | {text = '📕 Todos los Comandos', callback_data = '!user'}, 11 | }, 12 | { 13 | {text = '✅ Canal', url = 'https://telegram.me/'..config.channel:gsub('@', '')}, 14 | {text = '✅ GitHub', url = 'https://github.com/ridrogo/ModeradorBot'}, 15 | }, 16 | { 17 | {text = '✅ Wamods.com', url = 'https://telegram.me/Wamods'}, 18 | {text = '✅ WereWolf Español Oficial', url = 'https://telegram.me/werewolfespoficial'}, 19 | }, 20 | { 21 | {text = '✅ Death Note Serie', url = 'https://telegram.me/DeathNoteSerie'}, 22 | {text = '✅ Evalúame!', url = 'https://telegram.me/storebot?start=GroupButlerEsp_bot'}, 23 | }, 24 | { 25 | {text = '🔙', callback_data = '!user'} 26 | } 27 | } 28 | return keyboard 29 | end 30 | 31 | local function do_keyboard_startme() 32 | local keyboard = {} 33 | keyboard.inline_keyboard = { 34 | { 35 | {text = 'Debes iniciarme primero', url = 'https://telegram.me/'..bot.username} 36 | } 37 | } 38 | return keyboard 39 | end 40 | 41 | local action = function(msg, blocks, ln) 42 | local keyboard = do_keyboard_public() 43 | if blocks[1] == 'links' then 44 | if msg.chat.type == 'private' then 45 | local message = make_text(lang[ln].help.private, msg.from.first_name:mEscape()) 46 | local keyboard = do_keyboard_public() 47 | api.sendKeyboard(msg.from.id, message, keyboard, true) 48 | return 49 | end 50 | local res = api.sendKeyboard(msg.from.id, 'Aquí tienes algunos links de interés, quieres aparecer aqui?, contacta con @Webrom o @Webrom2', keyboard, true) 51 | if res then 52 | api.sendMessage(msg.chat.id, 'Se han enviado los links por chat privado', true) 53 | else 54 | api.sendKeyboard(msg.chat.id, lang[ln].help.group_not_success, do_keyboard_startme(), true) 55 | end 56 | end 57 | return 58 | end 59 | 60 | return { 61 | action = action, 62 | triggers = { 63 | '^/(links)$' 64 | } 65 | } -------------------------------------------------------------------------------- /plugins/rules.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks, ln) 2 | 3 | if msg.chat.type == 'private' then return end 4 | 5 | local hash = 'chat:'..msg.chat.id..':rules' 6 | if blocks[1] == 'rules' then 7 | local out = cross.getRules(msg.chat.id, ln) 8 | if is_locked(msg, 'Rules') and not is_mod(msg) then 9 | api.sendMessage(msg.from.id, out, true) 10 | else 11 | api.sendReply(msg, out, true) 12 | end 13 | end 14 | 15 | if not is_mod(msg) then 16 | return 17 | end 18 | 19 | if blocks[1] == 'addrules' then 20 | if not blocks[2] then 21 | api.sendReply(msg, lang[ln].setabout.no_input_add) 22 | return 23 | end 24 | local rules = db:get(hash) 25 | --check if rules are empty 26 | if not rules then 27 | api.sendReply(msg, lang[ln].setrules.no_rules_add, true) 28 | else 29 | local input = blocks[2] 30 | if not input then 31 | api.sendReply(msg, lang[ln].setrules.no_input_add, true) 32 | return nil 33 | end 34 | 35 | --add the new string to the rules 36 | local res = api.sendReply(msg, make_text(lang[ln].setrules.added, input), true) 37 | if not res then 38 | api.sendReply(msg, lang[ln].breaks_markdown, true) 39 | else 40 | rules = rules..'\n'..input 41 | db:set(hash, rules) 42 | end 43 | end 44 | end 45 | if blocks[1] == 'setrules' then 46 | local input = blocks[2] 47 | --ignore if not input text 48 | if not input then 49 | api.sendReply(msg, lang[ln].setrules.no_input_set, true) 50 | return 51 | end 52 | --check if a mod want to clean the rules 53 | if input == '^clean' then 54 | db:del(hash) 55 | api.sendReply(msg, lang[ln].setrules.clean) 56 | return 57 | end 58 | 59 | --set the new rules 60 | local res, code = api.sendReply(msg, input, true) 61 | if not res then 62 | if code == 118 then 63 | api.sendMessage(msg.chat.id, lang[ln].bonus.too_long) 64 | else 65 | api.sendMessage(msg.chat.id, lang[ln].breaks_markdown, true) 66 | end 67 | else 68 | db:set(hash, input) 69 | local id = res.result.message_id 70 | api.editMessageText(msg.chat.id, id, lang[ln].setrules.rules_setted, false, true) 71 | end 72 | end 73 | 74 | end 75 | 76 | return { 77 | action = action, 78 | triggers = { 79 | '^/(setrules)$', 80 | '^/(setrules) (.*)', 81 | '^/(rules)$', 82 | '^/(addrules)$', 83 | '^/(addrules) (.*)' 84 | } 85 | } -------------------------------------------------------------------------------- /plugins/saludador.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks, ln) 2 | 3 | -- if not (msg.chat.type == 'private') and is_mod(msg) then return end 4 | 5 | if db:hget('chat:'..msg.chat.id..':settings', 'saludo') == 'enable' then 6 | local iduser = msg.from.id 7 | local name = msg.from.first_name 8 | if msg.from.username then name = name..' (@'..msg.from.username..')' end 9 | math.randomseed( os.time() ); 10 | var = math.random(0,4); 11 | if var == 0 then 12 | api.sendMessage(msg.chat.id, 'Hola *' ..name.. '*', true) 13 | elseif var == 1 then 14 | api.sendMessage(msg.chat.id, 'Hola *' ..name.. '* ¿Todo bien?', true) 15 | elseif var == 2 then 16 | api.sendMessage(msg.chat.id, 'Qué onda *' ..name.. '*, un gusto verte :)', true) 17 | elseif var == 3 then 18 | api.sendMessage(msg.chat.id, '*' ..name.. '* :) Hola', true) 19 | elseif var == 4 then 20 | api.sendMessage(msg.chat.id, 'Sr *' ..name.. '*, un gusto verlo por aquí.', true) 21 | end 22 | end 23 | end 24 | return { 25 | action = action, 26 | triggers = { 27 | "[Hh][Oo][Ll][Aa]", 28 | -- "[Hh][Ii]", 29 | "[Qq][Uu][Ee](.*)[Oo][Nn][Dd][Aa]", 30 | } 31 | } -------------------------------------------------------------------------------- /plugins/saludame.lua: -------------------------------------------------------------------------------- 1 | local triggers = { 2 | '^/(saluda) (.*)$' 3 | } 4 | 5 | 6 | local action = function(msg, matches, ln) 7 | 8 | if matches[1] == 'saluda' then 9 | 10 | api.sendMessage(msg.chat.id, '' ..matches[2].. '', true) 11 | end 12 | end 13 | 14 | 15 | return { 16 | action = action, 17 | triggers = triggers 18 | } 19 | -------------------------------------------------------------------------------- /plugins/say.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, matches, ln) 2 | api.sendMessage(msg.chat.id, make_text '' ..matches[1].. '', true) 3 | end 4 | 5 | return { 6 | action = action, 7 | triggers = { 8 | '^/[Ss]ay (.*)$', 9 | '^/di (.*)$' 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /plugins/sendfiles.lua: -------------------------------------------------------------------------------- 1 | local triggers = { 2 | '^/send (imagen) (.*)$', 3 | '^/send (sticker) (.*)$', 4 | '^/send (archivo) (.*)$', 5 | '^/send (gif) (.*)$', 6 | '^/send (video) (.*)$', 7 | '^/send (formatos)$', 8 | } 9 | 10 | local action = function(msg, blocks) 11 | --blocks de imagenes 12 | if blocks[1] == 'imagen' then 13 | imagen = blocks[2] 14 | api.sendPhoto(msg.chat.id, './enviar/imagen/' ..imagen.. '.jpg') 15 | api.sendPhoto(msg.chat.id, './enviar/imagen/' ..imagen.. '.jpeg') 16 | api.sendPhoto(msg.chat.id, './enviar/imagen/' ..imagen.. '.png') 17 | api.sendPhoto(msg.chat.id, './enviar/imagen/' ..imagen.. '.tiff') 18 | api.sendPhoto(msg.chat.id, './enviar/imagen/' ..imagen.. '.psd') 19 | end 20 | 21 | --blocks de stickers 22 | if blocks[1] == 'sticker' then 23 | sticker = blocks[2] 24 | api.sendSticker(msg.chat.id, './enviar/sticker/' ..sticker.. '.webp') 25 | end 26 | 27 | -- blocks de archivos 28 | if blocks[1] == 'archivo' then 29 | archivo = blocks[2] 30 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.jpg') 31 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.psd') 32 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.swf') 33 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.jpeg') 34 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.zip') 35 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.rar') 36 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.lua') 37 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.png') 38 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.webp') 39 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.tar') 40 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.gz') 41 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.tar.gz') 42 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.sh') 43 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.img') 44 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.lnk') 45 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.gif') 46 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.rdb') 47 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.exe') 48 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.mp3') 49 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.wma') 50 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.aac') 51 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.flac') 52 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.mp4') 53 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.webm') 54 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.wmv') 55 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.apk') 56 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.ipa') 57 | api.sendDocument(msg.chat.id, './enviar/archivo/' ..archivo.. '.avi') 58 | end 59 | 60 | --blocks de gif 61 | if blocks[1] == 'gif' then 62 | gif = blocks[2] 63 | api.sendVideo(msg.chat.id, './enviar/gif/' ..gif.. '.gif') 64 | api.sendVideo(msg.chat.id, './enviar/gif/' ..gif.. '.mp4') 65 | end 66 | 67 | -- blocks de video 68 | if blocks[1] == 'video' then 69 | video = blocks[2] 70 | api.sendVideo(msg.chat.id, './enviar/video/' ..video.. '.mp4') 71 | api.sendVideo(msg.chat.id, './enviar/video/' ..video.. '.webm') 72 | api.sendVideo(msg.chat.id, './enviar/video/' ..video.. '.mov') 73 | api.sendVideo(msg.chat.id, './enviar/video/' ..video.. '.wmv') 74 | api.sendVideo(msg.chat.id, './enviar/video/' ..video.. '.dvd') 75 | api.sendVideo(msg.chat.id, './enviar/video/' ..video.. '.avi') 76 | api.sendVideo(msg.chat.id, './enviar/video/' ..video.. '.mkv') 77 | api.sendVideo(msg.chat.id, './enviar/video/' ..video.. '.3gp') 78 | api.sendVideo(msg.chat.id, './enviar/video/' ..video.. '.3g2') 79 | api.sendVideo(msg.chat.id, './enviar/video/' ..video.. '.m4v') 80 | api.sendVideo(msg.chat.id, './enviar/video/' ..video.. '.m4p') 81 | api.sendVideo(msg.chat.id, './enviar/video/' ..video.. '.divx') 82 | api.sendVideo(msg.chat.id, './enviar/video/' ..video.. '.wmv') 83 | end 84 | 85 | -- Blocks de formatos 86 | if blocks[1] == 'formatos' then 87 | api.sendReply(msg, make_text '_Si enviaste este mensaje en un grupo, el bot te enviará los formatos compatibles solamente por PV_\n\n_Si no haz iniciado el bot primero inicialo_.\nIniciame [aquí](http://telegram.me/Moderadores_Bot)', true) 88 | -- Responde con los formatos disponibles al PV 89 | api.sendMessage(msg.from.id, make_text '*Haz solicitado los formatos disponibles*.\n\n_Formatos de archivos_\n- jpg\n- jpeg\n- png\n- psd\n- swf\n- tar\n- tar.gz\n- gz\n- zip\n- rar\n- lua\n- webp\n- sh\n- img\n- lnk\n- gif\n- rdb\n- exe\n- mp3\n- wma\n- aac\n- flac\n- mp4\n- webm\n- wmv\n- apk\n- ipa\n- avi\n\n_Formatos de video_\n- mp4\n- webm\n- mov\n- mwv\n- dvd\n- avi\n- mkv\n- 3gp\n- 3g2\n- m4v\n- m4p\n- divx\n- wmv\n\n_Formatos de imagen_\n- jpeg\n- jpg\n- png\n- tiff\n- psd\n\n_Formatos de stickers_\n- webp\n\n_Formatos de gif_\n- gif\n- mp4 ', true) 90 | end -- cierre de blocks 91 | end -- cierre de script completo 92 | return { 93 | triggers = triggers, 94 | action = action 95 | } 96 | -------------------------------------------------------------------------------- /plugins/sera.lua: -------------------------------------------------------------------------------- 1 | local action = function(msg, blocks) 2 | num = math.random(0,8); 3 | if num == 0 then 4 | api.sendReply(msg, '_Sí_.', true) 5 | elseif num == 1 then 6 | api.sendReply(msg, '_No_.', true) 7 | elseif num == 2 then 8 | api.sendReply(msg, '_Puede ser que sí_.', true) 9 | elseif num == 3 then 10 | api.sendReply(msg, '_Puede ser que no_.', true) 11 | elseif num == 4 then 12 | api.sendReply(msg, '_Eso es muy tonto_.', true) 13 | elseif num == 5 then 14 | api.sendReply(msg, '_Pregunta otra cosa_.', true) 15 | elseif num == 6 then 16 | api.sendReply(msg, '_Yo no lo creo_.', true) 17 | elseif num == 7 then 18 | api.sendReply(msg, '_Sin palabras_.', true) 19 | elseif num == 8 then 20 | api.sendReply(msg, '_Imposible_.', true) 21 | end 22 | end 23 | 24 | return { 25 | action = action, 26 | triggers = { 27 | '/sera (.*)' 28 | } 29 | } -------------------------------------------------------------------------------- /plugins/service.lua: -------------------------------------------------------------------------------- 1 | local function gsub_custom_welcome(msg, custom) 2 | local name = msg.added.first_name:mEscape() 3 | local name = name:gsub('%%', '') 4 | local id = msg.added.id 5 | local id2 = msg.chat.id 6 | local username 7 | local title = msg.chat.title:mEscape() 8 | if msg.added.username then 9 | username = '@'..msg.added.username:mEscape() 10 | else 11 | username = '(sin usuario)' 12 | end 13 | custom = custom:gsub('$name', name):gsub('$username', username):gsub('$id', id):gsub('$title', title):gsub('$id2', id2) 14 | return custom 15 | end 16 | 17 | local function get_welcome(msg, ln) 18 | if is_locked(msg, 'Welcome') then 19 | return false 20 | end 21 | local type = db:hget('chat:'..msg.chat.id..':welcome', 'type') 22 | local content = db:hget('chat:'..msg.chat.id..':welcome', 'content') 23 | if type == 'media' then 24 | local file_id = content 25 | api.sendDocumentId(msg.chat.id, file_id) 26 | return false 27 | elseif type == 'custom' then 28 | return gsub_custom_welcome(msg, content) 29 | elseif type == 'composed' then 30 | if not(content == 'no') then 31 | local abt = cross.getAbout(msg.chat.id, ln) 32 | local rls = cross.getRules(msg.chat.id, ln) 33 | local creator, admins = cross.getModlist(msg.chat.id, ln) 34 | print(admins) 35 | local mods 36 | if not creator then 37 | mods = '\n' 38 | else 39 | mods = make_text(lang[ln].service.welcome_modlist, creator:mEscape(), admins:gsub('*', ''):mEscape()) 40 | end 41 | local text = make_text(lang[ln].service.welcome, msg.added.first_name:mEscape_hard(), msg.chat.title:mEscape_hard()) 42 | if content == 'a' then 43 | text = text..'\n\n'..abt 44 | elseif content == 'r' then 45 | text = text..'\n\n'..rls 46 | elseif content == 'm' then 47 | text = text..mods 48 | elseif content == 'ra' then 49 | text = text..'\n\n'..abt..'\n\n'..rls 50 | elseif content == 'am' then 51 | text = text..'\n\n'..abt..mods 52 | elseif content == 'rm' then 53 | text = text..'\n\n'..rls..mods 54 | elseif content == 'ram' then 55 | text = text..'\n\n'..abt..'\n\n'..rls..mods 56 | end 57 | return text 58 | else 59 | return make_text(lang[ln].service.welcome, msg.added.first_name:mEscape_hard(), msg.chat.title:mEscape_hard()) 60 | end 61 | end 62 | end 63 | 64 | local action = function(msg, blocks, ln) 65 | 66 | --avoid trolls 67 | if not msg.service then return end 68 | 69 | --if the bot join the chat 70 | if blocks[1] == 'botadded' then 71 | api.sendMessage(msg.chat.id, '\nGracias por agregarme a tu grupo, ahora para configurarme correctamente tienes que darme admin (revisa [aqui](http://telegram.me/GroupButlerEsp/1)) y contacta con @Webrom o @Webrom2, séra un placer servirte en tu grupo 🔰\n', true) 72 | 73 | if msg.added.username and is_mod(msg) then 74 | print('Usuario', msg.from.username, msg.from.id, msg.added.username, msg.added.id, msg.chat.title, msg.chat.id) 75 | local id = msg.from.id 76 | local name = msg.from.first_name 77 | if msg.from.username then name = name..' (@'..msg.from.username..')' end 78 | local title = msg.chat.title 79 | local id2 = msg.chat.id 80 | api.sendAdmin('`🔰📋 Infomacion del usuario que agrega el BOT:`\n\n*👤 Usuario y Alias:* '..name..'\n*👤 Usuario 🆔* '..id..'\n*🔹 Nombre del grupo:* '..title..'\n*🔸Grupo 🆔* '..id2..'\n', true) 81 | else 82 | api.sendMessage(msg.chat.id, '_Tú ('..msg.adder.first_name:mEscape()..', '..msg.adder.id..')´ , no puedes agregarme a este grupo, sólo el Creador del grupo puede agregarme y los Admins para testeo_', true) 83 | api.leaveChat(msg.chat.id) 84 | return 85 | end 86 | 87 | if is_blocked_global(msg.adder.id) then 88 | api.sendMessage(msg.chat.id, '_Tú ('..msg.adder.first_name:mEscape()..', '..msg.adder.id..') estás bloqueado Globalmente, no puedes usar este Bot_', true) 89 | api.leaveChat(msg.chat.id) 90 | return 91 | end 92 | 93 | cross.initGroup(msg.chat.id) 94 | end 95 | 96 | --if someone join the chat 97 | if blocks[1] == 'added' then 98 | 99 | if msg.chat.type == 'group' and is_banned(msg.chat.id, msg.added.id) then 100 | api.kickChatMember(msg.chat.id, msg.added.id) 101 | return 102 | end 103 | 104 | if msg.chat.type == 'supergroup' and is_prebanned(msg.chat.id, msg.added.id) then 105 | if msg.adder and is_mod(msg) then --if the user is added by a moderator, remove the added user from the prevbans 106 | db:srem('chat:'..msg.chat.id..':prevban', msg.added.id) 107 | else --if added by a not-mod, ban the user 108 | local res = api.banUser(msg.chat.id, msg.added.id, false, ln) 109 | if res then 110 | api.sendMessage(msg.chat.id, make_text(lang[ln].banhammer.was_banned, msg.added.first_name)) 111 | end 112 | end 113 | end 114 | 115 | cross.remBanList(msg.chat.id, msg.added.id) --remove him from the banlist 116 | 117 | --[[if not(msg.chat.type == 'private') and not is_mod(msg) then 118 | if db:hget('chat:'..msg.chat.id..':settings', 'bots') == 'disable' then 119 | if (msg.new_chat_member.id) == (bot.id) then 120 | -- api.kickChatMember(msg.chat.id, msg.new_chat_member) 121 | else --if added by a not-mod, ban the user 122 | local res = api.banUser(msg.chat.id, msg.new_chat_member.id, false, ln) 123 | if res then 124 | api.sendMessage(msg.chat.id, '_Tu ('..msg.adder.first_name:mEscape()..', '..msg.adder.id..') no puedes agregar bots_', true) end 125 | end 126 | end 127 | end]] 128 | 129 | if not(msg.chat.type == 'private') and not is_mod(msg) then 130 | if db:hget('chat:'..msg.chat.id..':settings', 'bots') == 'disable' and not msg.added.last_name then 131 | if msg.added.username == bot.id then 132 | else 133 | local username = msg.added.username:lower() 134 | if username:find('bot', -3) then 135 | local res = api.banUser(msg.chat.id, msg.added.id, false, ln) 136 | if res then 137 | api.sendMessage(msg.chat.id, '_Tu ('..msg.adder.first_name:mEscape()..', '..msg.adder.id..') no puedes agregar bots_', true) 138 | return end 139 | end 140 | end 141 | end 142 | end 143 | -- if msg.added.username then 144 | -- local username = msg.added.username:lower() 145 | -- if username:find('bot', -3) then return end 146 | -- end 147 | 148 | local text = get_welcome(msg, ln) 149 | if text then 150 | api.sendMessage(msg.chat.id, text, true) 151 | end 152 | 153 | --if not text: welcome is locked 154 | end 155 | 156 | --if the bot is removed from the chat 157 | if blocks[1] == 'botremoved' then 158 | api.sendMessage(msg.from.id, '\nEs una lástima que me hayas sacado, si cambias de opinión puedes volver a agregarme (revisa [aqui](http://telegram.me/GroupButlerEsp/1)) y contacta con @Webrom o @Webrom2, séra un placer volver a servirte en tu grupo 🔰\n', true) 159 | 160 | if msg.removed.username then 161 | print('Usuario', msg.from.username, msg.from.id, msg.removed.username, msg.removed.id, msg.chat.title, msg.chat.id) 162 | local id = msg.from.id 163 | local name = msg.from.first_name 164 | if msg.from.username then name = name..' (@'..msg.from.username..')' end 165 | local title = msg.chat.title 166 | local id2 = msg.chat.id 167 | api.sendAdmin('`🔰📋 Infomacion del usuario que elimina el BOT:`\n\n*👤 Usuario y Alias:* '..name..'\n*👤 Usuario 🆔* '..id..'\n*🔹 Nombre del grupo:* '..title..'\n*🔸Grupo 🆔* '..id2..'\n', true) 168 | return 169 | end 170 | 171 | --remove the group settings 172 | cross.remGroup(msg.chat.id, true) 173 | 174 | --save stats 175 | db:hincrby('bot:general', 'groups', -1) 176 | end 177 | 178 | if blocks[1] == 'removed' then 179 | if msg.removed.username then 180 | local name = msg.from.first_name 181 | local title = msg.chat.title 182 | api.sendMessage(msg.from.id, '\n' ..name.. ', es una lástima que te hayas ido de ' ..title.. ', si cambias de opinión y quieres volver a ingresar, solo dile a @Webrom o @Webrom2 que te ayude, gracias por participar. 🔰\n', true) 183 | return 184 | end 185 | if msg.remover and msg.removed then 186 | if msg.remover.id ~= msg.removed.id and msg.remover.id ~= bot.id then 187 | local action 188 | if msg.chat.type == 'supergroup' then 189 | action = 'ban' 190 | elseif msg.chat.type == 'group' then 191 | action = 'kick' 192 | end 193 | cross.saveBan(msg.removed.id, action) 194 | end 195 | end 196 | end 197 | end 198 | 199 | return { 200 | action = action, 201 | triggers = { 202 | '^###(botadded)', 203 | '^###(added)', 204 | '^###(botremoved)', 205 | '^###(removed)' 206 | } 207 | } 208 | -------------------------------------------------------------------------------- /plugins/setlang.lua: -------------------------------------------------------------------------------- 1 | local function doKeyboard_lang() 2 | local keyboard = { 3 | inline_keyboard = {} 4 | } 5 | for i,lang in pairs(config.available_languages) do 6 | local line = {{text = lang, callback_data = 'langselected:'..lang}} 7 | table.insert(keyboard.inline_keyboard, line) 8 | end 9 | return keyboard 10 | end 11 | 12 | local action = function(msg, blocks, ln) 13 | if msg.chat.type ~= 'private' and not is_mod(msg) then 14 | if msg.cb then 15 | api.answerCallbackQuery(msg.cb_id, lang[ln].not_mod:mEscape_hard()) 16 | end 17 | return 18 | end 19 | 20 | local keyboard 21 | 22 | if blocks[1] == 'lang' and not blocks[2] then 23 | keyboard = doKeyboard_lang() 24 | 25 | api.sendKeyboard(msg.chat.id, lang[ln].setlang.list, keyboard, true) 26 | end 27 | if blocks[1] == 'langselected' and msg.cb then 28 | local selected = blocks[2] 29 | db:set('lang:'..msg.chat.id, selected) 30 | api.editMessageText(msg.chat.id, msg.message_id, make_text(lang[selected].setlang.success, selected), false, true) 31 | end 32 | end 33 | 34 | return { 35 | action = action, 36 | triggers = { 37 | '^/(lang)$', 38 | '^###cb:(langselected):(%a%a)$' 39 | } 40 | } -------------------------------------------------------------------------------- /plugins/settings.lua: -------------------------------------------------------------------------------- 1 | local function disable_set(field, msg, ln) 2 | local hash = 'chat:'..msg.chat.id..':settings' 3 | local field_lower = field:lower() 4 | local now = db:hget(hash, field) 5 | if now == 'yes' then 6 | api.sendReply(msg, make_text(lang[ln].settings.disable[field_lower..'_already']), true) 7 | else 8 | db:hset(hash, field, 'yes') 9 | api.sendReply(msg, make_text(lang[ln].settings.disable[field_lower..'_locked']), true) 10 | end 11 | end 12 | 13 | local function enable_set(field, msg, ln) 14 | local hash = 'chat:'..msg.chat.id..':settings' 15 | local field_lower = field:lower() 16 | local now = db:hget(hash, field) 17 | if now == 'no' then 18 | api.sendReply(msg, make_text(lang[ln].settings.enable[field_lower..'_already']), true) 19 | else 20 | db:hset(hash, field, 'no') 21 | api.sendReply(msg, make_text(lang[ln].settings.enable[field_lower..'_unlocked']), true) 22 | end 23 | end 24 | 25 | local action = function(msg, blocks, ln) 26 | 27 | --ignore if via pm 28 | if msg.chat.type == 'private' then 29 | api.sendMessage(msg.from.id, lang[ln].pv) 30 | return 31 | end 32 | 33 | if not is_mod(msg) then return end 34 | 35 | if blocks[1] == 'disable' then 36 | 37 | local input = msg.text:input() 38 | 39 | --ignore if not input text 40 | if not input then 41 | api.sendReply(msg, make_text(lang[ln].settings.disable.no_input), false) 42 | return nil 43 | end 44 | 45 | local hash = 'chat:'..msg.chat.id..':settings' 46 | local now 47 | 48 | --check the command to unlock 49 | if input == 'rules' then 50 | -- mystat('/disable rules') --save stats 51 | disable_set('Rules', msg, ln) 52 | elseif input == 'about' then 53 | -- mystat('/disable about') --save stats 54 | disable_set('About', msg, ln) 55 | elseif input == 'welcome' then 56 | -- mystat('/disable welcome') --save stats 57 | disable_set('Welcome', msg, ln) 58 | elseif input == 'modlist' then 59 | -- mystat('/disable modlist') --save stats 60 | disable_set('Modlist', msg, ln) 61 | elseif input == 'extra' then 62 | -- mystat('/disable extra') --save stats 63 | disable_set('Extra', msg, ln) 64 | elseif input == 'rtl' then 65 | -- mystat('/disable rtl') --save stats 66 | disable_set('Rtl', msg, ln) 67 | elseif input == 'arab' then 68 | -- mystat('/disable arab') --save stats 69 | disable_set('Arab', msg, ln) 70 | elseif input == 'report' then 71 | -- mystat('/disable report') --save stats 72 | disable_set('Report', msg, ln) 73 | elseif input == 'spam' then 74 | -- mystat('/disable report') --save stats 75 | disable_set('Spam', msg, ln) 76 | elseif input == 'plugins' then 77 | -- mystat('/disable report') --save stats 78 | disable_set('Plugins', msg, ln) 79 | else 80 | api.sendReply(msg, make_text(lang[ln].settings.disable.wrong_input), true) 81 | end 82 | 83 | end 84 | 85 | if blocks[1] == 'enable' then 86 | 87 | local input = msg.text:input() 88 | 89 | --ignore if not input text 90 | if not input then 91 | api.sendReply(msg, make_text(lang[ln].settings.enable.no_input), false) 92 | return nil 93 | end 94 | 95 | local hash = 'chat:'..msg.chat.id..':settings' 96 | local now 97 | 98 | --check the command to enable 99 | if input == 'rules' then 100 | -- mystat('/enable rules') --save stats 101 | enable_set('Rules', msg, ln) 102 | elseif input == 'about' then 103 | -- mystat('/enable about') --save stats 104 | enable_set('About', msg, ln) 105 | elseif input == 'welcome' then 106 | -- mystat('/enable welcome') --save stats 107 | enable_set('Welcome', msg, ln) 108 | elseif input == 'modlist' then 109 | -- mystat('/enable modlist') --save stats 110 | enable_set('Modlist', msg, ln) 111 | elseif input == 'extra' then 112 | -- mystat('/enable extra') --save stats 113 | enable_set('Extra', msg, ln) 114 | elseif input == 'rtl' then 115 | -- mystat('/enable rtl') --save stats 116 | enable_set('Rtl', msg, ln) 117 | elseif input == 'arab' then 118 | -- mystat('/enable arab') --save stats 119 | enable_set('Arab', msg, ln) 120 | elseif input == 'report' then 121 | -- mystat('/enable report') --save stats 122 | enable_set('Report', msg, ln) 123 | elseif input == 'spam' then 124 | -- mystat('/enable report') --save stats 125 | enable_set('Spam', msg, ln) 126 | elseif input == 'plugins' then 127 | -- mystat('/disable report') --save stats 128 | enable_set('Plugins', msg, ln) 129 | else 130 | api.sendReply(msg, make_text(lang[ln].settings.enable.wrong_input), true) 131 | end 132 | 133 | end 134 | 135 | if blocks[1] == 'welcome' then 136 | 137 | local input = blocks[2] 138 | 139 | --ignore if not input text and not reply 140 | if not input and not msg.reply then 141 | api.sendReply(msg, make_text(lang[ln].settings.welcome.no_input), false) 142 | return 143 | end 144 | 145 | local hash = 'chat:'..msg.chat.id..':welcome' 146 | 147 | if not input and msg.reply then 148 | local replied_to = get_media_type(msg.reply) 149 | if replied_to == 'sticker' or replied_to == 'gif' then 150 | local file_id-- = msg[replied_to].file_id 151 | if replied_to == 'sticker' then 152 | file_id = msg.reply.sticker.file_id 153 | else 154 | file_id = msg.reply.document.file_id 155 | end 156 | db:hset(hash, 'type', 'media') 157 | db:hset(hash, 'content', file_id) 158 | api.sendReply(msg, lang[ln].settings.welcome.media_setted..'`'..replied_to..'`', true) 159 | else 160 | api.sendReply(msg, lang[ln].settings.welcome.reply_media, true) 161 | end 162 | return 163 | end 164 | 165 | --change welcome settings 166 | if input == 'a' then 167 | db:hset(hash, 'type', 'composed') 168 | db:hset(hash, 'content', 'a') 169 | api.sendReply(msg, lang[ln].settings.welcome.a, true) 170 | elseif input == 'r' then 171 | db:hset(hash, 'type', 'composed') 172 | db:hset(hash, 'content', 'r') 173 | api.sendReply(msg, lang[ln].settings.welcome.r, true) 174 | elseif input == 'm' then 175 | db:hset(hash, 'type', 'composed') 176 | db:hset(hash, 'content', 'm') 177 | api.sendReply(msg, lang[ln].settings.welcome.m, true) 178 | elseif input == 'ar' or input == 'ra' then 179 | db:hset(hash, 'type', 'composed') 180 | db:hset(hash, 'content', 'ra') 181 | api.sendReply(msg, lang[ln].settings.welcome.ra, true) 182 | elseif input == 'mr' or input == 'rm' then 183 | db:hset(hash, 'type', 'composed') 184 | db:hset(hash, 'content', 'rm') 185 | api.sendReply(msg, lang[ln].settings.welcome.rm, true) 186 | elseif input == 'am' or input == 'ma' then 187 | db:hset(hash, 'type', 'composed') 188 | db:hset(hash, 'content', 'am') 189 | api.sendReply(msg, lang[ln].settings.welcome.am, true) 190 | elseif input == 'ram' or input == 'rma' or input == 'arm' or input == 'amr' or input == 'mra' or input == 'mar' then 191 | db:hset(hash, 'type', 'composed') 192 | db:hset(hash, 'content', 'ram') 193 | api.sendReply(msg, lang[ln].settings.welcome.ram, true) 194 | elseif input == 'no' then 195 | db:hset(hash, 'type', 'composed') 196 | db:hset(hash, 'content', 'no') 197 | api.sendReply(msg, lang[ln].settings.welcome.no, true) 198 | else 199 | db:hset(hash, 'type', 'custom') 200 | db:hset(hash, 'content', input) 201 | local res, code = api.sendReply(msg, make_text(lang[ln].settings.welcome.custom, input), true) 202 | if not res then 203 | db:hset(hash, 'type', 'composed') --if wrong markdown, remove 'custom' again 204 | db:hset(hash, 'content', 'no') 205 | if code == 118 then 206 | api.sendMessage(msg.chat.id, lang[ln].bonus.too_long) 207 | else 208 | api.sendMessage(msg.chat.id, lang[ln].breaks_markdown, true) 209 | end 210 | else 211 | local id = res.result.message_id 212 | api.editMessageText(msg.chat.id, id, lang[ln].settings.welcome.custom_setted, false, true) 213 | end 214 | end 215 | 216 | -- mystat('/welcome') --save stats 217 | end 218 | 219 | if blocks[1] == 'settings' then 220 | 221 | --get settings 222 | local message = cross.getSettings(msg.chat.id, ln) 223 | 224 | -- mystat('/settings') --save stats 225 | api.sendReply(msg, message, true) 226 | end 227 | 228 | end 229 | 230 | return { 231 | action = action, 232 | triggers = { 233 | '^/(disable) (.*)$', 234 | '^/(enable) (.*)$', 235 | '^/(settings)$', 236 | '^/(welcome)$', 237 | '^/(welcome) (.*)$' 238 | } 239 | } 240 | -------------------------------------------------------------------------------- /plugins/talk.lua: -------------------------------------------------------------------------------- 1 | local triggers = { 2 | '^/(talk) (-?%d+) (.*)$', 3 | '^/(talk) (.*)$' 4 | } 5 | 6 | 7 | local action = function(msg, blocks, ln) 8 | 9 | if blocks[1] == 'talk' then 10 | if not blocks[2] then 11 | api.sendMessage(msg.from.id, 'Specify an id or reply with the message') 12 | return 13 | end 14 | local id, text 15 | if blocks[2]:match('(-?%d+)') then 16 | if not blocks[3] then 17 | api.sendMessage(msg.from.id, 'Text is missing') 18 | return 19 | end 20 | id = blocks[2] 21 | text = blocks[3] 22 | else 23 | if not msg.reply then 24 | api.sendMessage(msg.from.id, 'Reply to a user to send him a message') 25 | return 26 | end 27 | id = msg.reply.from.id 28 | text = blocks[2] 29 | end 30 | local res = api.sendMessage(id, text) 31 | if res then 32 | api.sendMessage(msg.chat.id, 'Successful delivery') 33 | end 34 | end 35 | 36 | end 37 | return { 38 | action = action, 39 | triggers = triggers 40 | } -------------------------------------------------------------------------------- /plugins/test.lua: -------------------------------------------------------------------------------- 1 | local triggers = { 2 | '^/test' 3 | } 4 | 5 | local function on_each_msg(msg, ln) 6 | return msg 7 | end 8 | 9 | local action = function(msg, blocks, ln) 10 | if blocks[1] == 'isbanned' and blocks[2] then 11 | if is_blocked(blocks[2]) then 12 | api.sendReply(msg, '✅ Este usuario si esta globalmente banneado.') 13 | else 14 | api.sendReply(msg, '❌❗️Este usuario no esta globalmente banneado o se ha ingresado el alias en lugar del ID. Si quieres reportarlo puedes reportarlo por privado a @Webrom o @Webrom2. Gracias.') 15 | end 16 | end 17 | end 18 | 19 | return { 20 | action = action, 21 | triggers = triggers, 22 | test = true 23 | } -------------------------------------------------------------------------------- /plugins/warn.lua: -------------------------------------------------------------------------------- 1 | local function doKeyboard_warn(user_id) 2 | local keyboard = {} 3 | keyboard.inline_keyboard = { 4 | { 5 | {text = 'Reset warns', callback_data = 'resetwarns:'..user_id}, 6 | {text = 'Remove warn', callback_data = 'removewarn:'..user_id} 7 | } 8 | } 9 | return keyboard 10 | end 11 | 12 | local function action(msg, blocks, ln) 13 | 14 | --warns/mediawarn 15 | 16 | if msg.chat.type == 'private' then return end 17 | if not is_mod(msg) then 18 | if msg.cb then --show a pop up if a normal user tap on an inline button 19 | api.answerCallbackQuery(msg.cb_id, lang[ln].not_mod:mEscape_hard()) 20 | end 21 | return 22 | end 23 | 24 | if blocks[1] == 'warnmax' then 25 | local new, default, is_media, key 26 | local hash = 'chat:'..msg.chat.id..':warnsettings' 27 | if blocks[2] == 'media' then 28 | new = blocks[3] 29 | default = 2 30 | key = 'mediamax' 31 | is_media = ' (media)' 32 | else 33 | key = 'max' 34 | new = blocks[2] 35 | default = 3 36 | is_media = '' 37 | end 38 | local old = (db:hget(hash, key)) or default 39 | db:hset(hash, key, new) 40 | local text = make_text(lang[ln].warn.warnmax, old, new, is_media) 41 | api.sendReply(msg, text, true) 42 | return 43 | end 44 | 45 | if blocks[1] == 'resetwarns' and msg.cb then 46 | local user_id = blocks[2] 47 | print(msg.chat.id, user_id) 48 | db:hdel('chat:'..msg.chat.id..':warns', user_id) 49 | db:hdel('chat:'..msg.chat.id..':mediawarn', user_id) 50 | 51 | api.editMessageText(msg.chat.id, msg.message_id, lang[ln].warn.nowarn..'\n`(Admin: '..msg.from.first_name:mEscape()..')`', false, true) 52 | return 53 | end 54 | 55 | if blocks[1] == 'removewarn' and msg.cb then 56 | local user_id = blocks[2] 57 | local num = db:hincrby('chat:'..msg.chat.id..':warns', user_id, -1) --add one warn 58 | local text, nmax, diff 59 | if tonumber(num) < 0 then 60 | text = lang[ln].warn.zero 61 | db:hincrby('chat:'..msg.chat.id..':warns', user_id, 1) --restore the previouvs number 62 | else 63 | nmax = (db:hget('chat:'..msg.chat.id..':warnsettings', 'max')) or 3 --get the max num of warnings 64 | diff = tonumber(nmax)-tonumber(num) 65 | text = make_text(lang[ln].warn.warn_removed, num, nmax) 66 | end 67 | 68 | api.editMessageText(msg.chat.id, msg.message_id, text..'\n`(Admin: '..msg.from.first_name:mEscape()..')`', false, true) 69 | return 70 | end 71 | 72 | --warning to reply to a message 73 | if not msg.reply then 74 | api.sendReply(msg, lang[ln].warn.warn_reply) 75 | return 76 | end 77 | --return nil if a mod is warned 78 | if is_mod(msg.reply) then 79 | api.sendReply(msg, lang[ln].warn.mod) 80 | return 81 | end 82 | --return nil if an user flag the bot 83 | if msg.reply.from.id == bot.id then 84 | return 85 | end 86 | 87 | if blocks[1] == 'warn' then 88 | 89 | local name = getname(msg.reply) 90 | local hash = 'chat:'..msg.chat.id..':warns' 91 | local num = db:hincrby(hash, msg.reply.from.id, 1) --add one warn 92 | local nmax = (db:hget('chat:'..msg.chat.id..':warnsettings', 'max')) or 3 --get the max num of warnings 93 | local text, res, motivation 94 | 95 | if tonumber(num) >= tonumber(nmax) then 96 | local type = (db:hget('chat:'..msg.chat.id..':warnsettings', 'type')) or 'kick' 97 | --try to kick/ban 98 | if type == 'ban' then 99 | text = make_text(lang[ln].warn.warned_max_ban, name:mEscape())..' ('..num..'/'..nmax..')' 100 | local is_normal_group = false 101 | if msg.chat.type == 'group' then is_normal_group = true end 102 | res, motivation = api.banUser(msg.chat.id, msg.reply.from.id, is_normal_group, ln) 103 | else --kick 104 | text = make_text(lang[ln].warn.warned_max_kick, name:mEscape())..' ('..num..'/'..nmax..')' 105 | res, motivation = api.kickUser(msg.chat.id, msg.reply.from.id, ln) 106 | end 107 | --if kick/ban fails, send the motivation 108 | if not res then 109 | if not motivation then 110 | motivation = lang[ln].banhammer.general_motivation 111 | end 112 | text = motivation 113 | else 114 | cross.saveBan(msg.reply.from.id, 'warn') --add ban 115 | if type == 'ban' then --add to the banlist 116 | local why = lang[ln].warn.ban_motivation 117 | if blocks[2] then why = blocks[2] end 118 | cross.addBanList(msg.chat.id, msg.reply.from.id, name, why) 119 | end 120 | db:hdel('chat:'..msg.chat.id..':warns', msg.reply.from.id) --if kick/ban works, remove the warns 121 | db:hdel('chat:'..msg.chat.id..':mediawarn', msg.reply.from.id) 122 | end 123 | api.sendReply(msg, text, true) --if the user reached the max num of warns, kick and send message 124 | else 125 | local diff = tonumber(nmax)-tonumber(num) 126 | text = make_text(lang[ln].warn.warned, name:mEscape(), num, nmax) 127 | local keyboard = doKeyboard_warn(msg.reply.from.id) 128 | api.sendKeyboard(msg.chat.id, text, keyboard, true, msg.message_id) --if the user is under the max num of warnings, send the inline keyboard 129 | end 130 | end 131 | end 132 | 133 | return { 134 | action = action, 135 | triggers = { 136 | '^/(warnmax) (%d%d?)$', 137 | '^/(warnmax) (media) (%d%d?)$', 138 | '^/(warn)$', 139 | '^/(warn) (.*)$', 140 | '^###cb:(resetwarns):(%d+)$', 141 | '^###cb:(removewarn):(%d+)$', 142 | } 143 | } -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$1" = "install" ]; then 4 | clear 5 | echo -e '\e[1;33m----------------------------------------------------\e[0m' 6 | echo -e '\e[1;33m----------------------------------------------------\e[0m' 7 | echo -e '\e[1;33m---- Moderador Bot ----\e[0m' 8 | echo -e '\e[1;33m---- Traduccion y algunos codigos por @Jarriz ----\e[0m' 9 | echo -e '\e[1;33m---- Contribuidores @george0884 @xxdamage ----\e[0m' 10 | echo -e '\e[1;33m---- @huezohuezo1990 ----\e[0m' 11 | echo -e '\e[1;33m---- @Webrom ----\e[0m' 12 | echo -e '\e[1;33m---- Mas funciones gracias a remembertheair ----\e[0m' 13 | echo -e '\e[1;33m----------------------------------------------------\e[0m' 14 | echo -e '\e[1;33m----------------------------------------------------\e[0m' 15 | echo '' 16 | read -t8 -p 'En unos segundos iniciara la instalacion' 17 | sudo apt-get update && 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 && wget http://luarocks.org/releases/luarocks-2.2.2.tar.gz && tar zxpf luarocks-2.2.2.tar.gz && cd luarocks-2.2.2 && sudo ./configure && sudo make bootstrap && sudo luarocks install luasocket && sudo luarocks install luasec && sudo luarocks install redis-lua && sudo luarocks install lua-term && sudo luarocks install serpent && sudo apt-get install curl && cd .. && sudo rm -Rf luarocks-2.2.2.tar.gz && sudo rm -Rf luarocks-2.2.2 18 | echo -e '\e[0;36mDependencias instaladas\e[0m' 19 | read -r -p 'Presione una tecla para continuar' 20 | sudo ./run.sh config 21 | fi 22 | 23 | if [ "$1" = "config" ]; then 24 | clear 25 | echo -e '\e[0;31mNOTA: al continuar eliminara el config.lua y clonara el archivo original\e[0m' 26 | echo -e '\e[0;31m todos los datos que ingreses a continuacion el script seran guardados\e[0m' 27 | echo -e '\e[0;31m si ya haz modificado el config.lua, cierra el script con CTRL + C. \e[0m' 28 | echo "Te pedira los datos necesarios para terminar de configurar el bot, por favor, ingresalos todos." 29 | read -n1 -r -p 'Presiona cualquier tecla para continuar' 30 | clear 31 | echo -e '\e[0;34mPor favor, ingresa tu apikey\e[0m' 32 | read apikey 33 | echo -e '\e[0;34mPor favor, ingresa tu ID Owner (Es el ID de la apikey de tu Bot)\e[0m' 34 | read id 35 | echo -e '\e[0;34mPor favor, ingresa tu ID Admin1 (Es tu ID Telegram o cualquier user que desees hacer Admin)\e[0m' 36 | read id1 37 | echo -e '\e[0;34mPor favor, ingresa tu ID Admin2 (ID de cualquier user que desees hacer Admin)\e[0m' 38 | read id2 39 | echo -e '\e[0;34mPor favor, ingresa tu canal sin considerar el @\e[0m' 40 | read channel 41 | sudo rm -f config.lua 42 | wget https://raw.githubusercontent.com/ridrogo/ModeradorBot/master/config.lua 43 | clear 44 | perl -pi -e "s[readapikey][$apikey]g" data/key 45 | perl -pi -e "s[readowner][$id]g" config.lua 46 | perl -pi -e "s[readadmin1][$id1]g" config.lua 47 | perl -pi -e "s[readadmin2][$id2]g" config.lua 48 | perl -pi -e "s[readchannel][$channel]g" config.lua 49 | clear 50 | echo -e '\e[0;32mOK. Configurado!\e[0m' 51 | read -n1 -r -p 'A continuacion se abrira el launcher del bot, cualquier falla, configuralo de nuevo.' 52 | sudo ./run.sh 53 | fi 54 | 55 | session=GroupButlerEsp 56 | session2=ScriptGban 57 | session3=RedisServer 58 | 59 | if [ "$1" = "" ]; then 60 | sudo tmux new-session -s "$session3" -d 'service redis-server start' 61 | sudo tmux new-session -s "$session" -d 'lua bot.lua' 62 | sudo tmux attach -t "$session" 63 | clear 64 | sudo tmux kill-session -t $session 65 | clear 66 | 67 | while true 68 | do 69 | lua bot.lua 70 | echo -e '\e[0;31mCRASH DETECTADO\e[0m' 71 | echo -e '\e[0;31mREINICIANDO\e[0m' 72 | for i in 1 73 | do 74 | echo "$i..." 75 | done 76 | echo -e '\e[0;32m###########################################\e[0m' 77 | echo -e '\e[0;32m# Bot reiniciado #"\e[0m' 78 | echo -e '\e[0;32m###########################################"\e[0m' 79 | done 80 | fi 81 | 82 | if [ "$1" = "attach" ]; then 83 | clear 84 | sudo tmux attach -t "$session" 85 | fi 86 | 87 | if [ "$1" = "attach-gbans" ]; then 88 | clear 89 | sudo tmux attach -t "$session2" 90 | fi 91 | 92 | 93 | if [ "$1" = "kill" ]; then 94 | clear 95 | sudo tmux kill-session -t $session 96 | sudo tmux kill-session -t $session2 97 | fi 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /run2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$1" = "install" ]; then 4 | clear 5 | echo -e '\e[1;33m----------------------------------------------------\e[0m' 6 | echo -e '\e[1;33m----------------------------------------------------\e[0m' 7 | echo -e '\e[1;33m---- Moderador Bot ----\e[0m' 8 | echo -e '\e[1;33m---- Traduccion y algunos codigos por @Jarriz ----\e[0m' 9 | echo -e '\e[1;33m---- Contribuidores @george0884 @xxdamage ----\e[0m' 10 | echo -e '\e[1;33m---- @huezohuezo1990 ----\e[0m' 11 | echo -e '\e[1;33m---- @Webrom ----\e[0m' 12 | echo -e '\e[1;33m---- Mas funciones gracias a remembertheair ----\e[0m' 13 | echo -e '\e[1;33m----------------------------------------------------\e[0m' 14 | echo -e '\e[1;33m----------------------------------------------------\e[0m' 15 | echo '' 16 | read -t8 -p 'En unos segundos iniciara la instalacion' 17 | sudo apt-get update && 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 && wget http://luarocks.org/releases/luarocks-2.2.2.tar.gz && tar zxpf luarocks-2.2.2.tar.gz && cd luarocks-2.2.2 && sudo ./configure && sudo make bootstrap && sudo luarocks install luasocket && sudo luarocks install luasec && sudo luarocks install redis-lua && sudo luarocks install lua-term && sudo luarocks install serpent && sudo apt-get install curl && cd .. && sudo rm -Rf luarocks-2.2.2.tar.gz && sudo rm -Rf luarocks-2.2.2 18 | echo -e '\e[0;36mDependencias instaladas\e[0m' 19 | read -r -p 'Presione una tecla para continuar' 20 | sudo ./run.sh config 21 | fi 22 | 23 | if [ "$1" = "config" ]; then 24 | clear 25 | echo -e '\e[0;31mNOTA: al continuar eliminara el config.lua y clonara el archivo original\e[0m' 26 | echo -e '\e[0;31m todos los datos que ingreses a continuacion el script seran guardados\e[0m' 27 | echo -e '\e[0;31m si ya haz modificado el config.lua, cierra el script con CTRL + C. \e[0m' 28 | echo "Te pedira los datos necesarios para terminar de configurar el bot, por favor, ingresalos todos." 29 | read -n1 -r -p 'Presiona cualquier tecla para continuar' 30 | clear 31 | echo -e '\e[0;34mPor favor, ingresa tu apikey\e[0m' 32 | read apikey 33 | echo -e '\e[0;34mPor favor, ingresa tu ID Owner (Es el ID de la apikey de tu Bot)\e[0m' 34 | read id 35 | echo -e '\e[0;34mPor favor, ingresa tu ID Admin1 (Es tu ID Telegram o cualquier user que desees hacer Admin)\e[0m' 36 | read id1 37 | echo -e '\e[0;34mPor favor, ingresa tu ID Admin2 (ID de cualquier user que desees hacer Admin)\e[0m' 38 | read id2 39 | echo -e '\e[0;34mPor favor, ingresa tu canal sin considerar el @\e[0m' 40 | read channel 41 | sudo rm -f config.lua 42 | wget https://raw.githubusercontent.com/ridrogo/ModeradorBot/master/config.lua 43 | clear 44 | perl -pi -e "s[readapikey][$apikey]g" config.lua 45 | perl -pi -e "s[readowner][$id]g" config.lua 46 | perl -pi -e "s[readadmin1][$id1]g" config.lua 47 | perl -pi -e "s[readadmin2][$id2]g" config.lua 48 | perl -pi -e "s[readchannel][$channel]g" config.lua 49 | clear 50 | echo -e '\e[0;32mOK. Configurado!\e[0m' 51 | read -n1 -r -p 'A continuacion se abrira el launcher del bot, cualquier falla, configuralo de nuevo.' 52 | sudo ./run.sh 53 | fi 54 | 55 | if [ "$1" = "kp" ]; then 56 | 57 | sudo screen -X -S running kill 58 | sudo service redis-server start 59 | clear 60 | while true 61 | do 62 | sudo screen -S running -t screen lua bot.lua 63 | echo -e '\e[0;31mCRASH DETECTADO\e[0m' 64 | echo -e '\e[0;31mREINICIANDO\e[0m' 65 | for i in 1 66 | do 67 | echo "$i..." 68 | done 69 | echo -e '\e[0;32m###########################################\e[0m' 70 | echo -e '\e[0;32m# Bot reiniciado #"\e[0m' 71 | echo -e '\e[0;32m###########################################"\e[0m' 72 | done 73 | fi 74 | 75 | 76 | if [ "$1" = "kill" ]; then 77 | 78 | sudo screen -X -S running kill 79 | 80 | clear 81 | 82 | echo -e '\e[0;31mBot detenido.\e[0m' 83 | 84 | fi 85 | 86 | if [ "$1" = "rmlogs" ]; then 87 | 88 | sudo rm -Rf logs/ 89 | 90 | clear 91 | 92 | echo -e '\e[0;31mLogs eliminados.\e[0m' 93 | 94 | fi 95 | 96 | 97 | 98 | if [ "$1" = "" ]; then 99 | 100 | sudo service redis-server start 101 | sudo screen -X -S running kill 102 | clear 103 | 104 | while true 105 | do 106 | lua bot.lua 107 | echo -e '\e[0;31mCRASH DETECTADO\e[0m' 108 | echo -e '\e[0;31mREINICIANDO\e[0m' 109 | for i in 1 110 | do 111 | echo "$i..." 112 | done 113 | echo -e '\e[0;32m###########################################\e[0m' 114 | echo -e '\e[0;32m# Bot reiniciado #"\e[0m' 115 | echo -e '\e[0;32m###########################################"\e[0m' 116 | done 117 | fi --------------------------------------------------------------------------------