1
0

BotGen.sh 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. #!/bin/bash
  2. # -*- ENCODING: UTF-8 -*-
  3. #https://github.com/joao-lucas/ShellBot
  4. CIDdir=/etc/ADM-db && [[ ! -d ${CIDdir} ]] && mkdir ${CIDdir}
  5. CIDimg=/etc/tokenIMG && [[ ! -d ${CIDimg} ]] && mkdir ${CIDimg}
  6. SRC="${CIDdir}/sources" && [[ ! -d ${SRC} ]] && mkdir ${SRC}
  7. CID="${CIDdir}/User-ID" && [[ ! -e ${CID} ]] && echo > ${CID}
  8. CIDRESS="${CIDdir}/RESSELLERS" && [[ ! -e ${CIDRESS} ]] && mkdir ${CIDRESS}
  9. keytxt="${CIDdir}/keys" && [[ ! -d ${keytxt} ]] && mkdir ${keytxt}
  10. timg="${CIDimg}/img" && [[ ! -d ${timg} ]] && mkdir ${timg}
  11. [[ $(dpkg --get-selections|grep -w "jq"|head -1) ]] || apt-get install jq -y &>/dev/null
  12. [[ ! -e "/bin/ShellBot.sh" ]] && wget -O /bin/ShellBot.sh https://raw.githubusercontent.com/ChumoGH/VPSbot/main/ShellBot.sh &> /dev/null
  13. [[ -e /etc/texto-bot ]] && rm /etc/texto-bot
  14. LINE=" ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••"
  15. # Importando API
  16. source ShellBot.sh
  17. source ${SRC}/menu
  18. source ${SRC}/ayuda
  19. source ${SRC}/cache
  20. source ${SRC}/invalido
  21. source ${SRC}/status
  22. source ${SRC}/reinicio
  23. source ${SRC}/myip
  24. source ${SRC}/id
  25. source ${SRC}/back_ID
  26. source ${SRC}/link
  27. source ${SRC}/listID
  28. source ${SRC}/gerar_key
  29. source ${SRC}/power
  30. source ${SRC}/comandos
  31. source ${SRC}/update
  32. source ${SRC}/donar
  33. source ${SRC}/costes
  34. #source ${SRC}/kill_drop.sh
  35. # Token del bot
  36. bot_token="$(cat ${CIDdir}/token)"
  37. # Inicializando el bot
  38. ShellBot.init --token "$bot_token" --monitor --flush --return map
  39. ShellBot.username
  40. reply () {
  41. [[ ! -z ${callback_query_message_chat_id[$id]} ]] && var=${callback_query_message_chat_id[$id]} || var=${message_chat_id[$id]}
  42. ShellBot.sendMessage --chat_id $var \
  43. --text "$comando" \
  44. --parse_mode html \
  45. --reply_markup "$(ShellBot.ForceReply)"
  46. [[ "${callback_query_data}" = /del || "${message_text}" = /del ]] && listID_src
  47. #[[ "${callback_query_data}" = /img || "${message_text}" = /img ]] && listID_src
  48. [[ "${callback_query_data}" = '/banIP' || "${message_text}" = '/banIP' ]] && list_IP
  49. }
  50. menu_print () {
  51. [[ ! -z ${callback_query_message_chat_id[$id]} ]] && var=${callback_query_message_chat_id[$id]} || var=${message_chat_id[$id]}
  52. if [[ $(echo $permited|grep "${chatuser}") = "" ]]; then
  53. # ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \
  54. ShellBot.sendMessage --chat_id $var \
  55. --text "<i>$(echo -e $bot_retorno)</i>" \
  56. --parse_mode html \
  57. --reply_markup "$(ShellBot.InlineKeyboardMarkup -b 'botao_user')"
  58. else
  59. # ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \
  60. ShellBot.sendMessage --chat_id $var \
  61. --text "<i>$(echo -e $bot_retorno)</i>" \
  62. --parse_mode html \
  63. --reply_markup "$(ShellBot.InlineKeyboardMarkup -b 'botao_conf')"
  64. fi
  65. }
  66. menu_printSN () {
  67. [[ ! -z ${callback_query_message_chat_id[$id]} ]] && var=${callback_query_message_chat_id[$id]} || var=${message_chat_id[$id]}
  68. if [[ $(echo $permited|grep "${chatuser}") = "" ]]; then
  69. ShellBot.sendMessage --chat_id $var \
  70. --text "<i>$(echo -e $bot_retorno)</i>" \
  71. --parse_mode html \
  72. --reply_markup "$(ShellBot.InlineKeyboardMarkup -b 'botao_send_id')"
  73. fi
  74. }
  75. download_file () {
  76. # shellbot.sh editado linea 3986
  77. user=User-ID
  78. [[ -e ${CID} ]] && rm ${CID}
  79. local file_id
  80. ShellBot.getFile --file_id ${message_document_file_id[$id]}
  81. ShellBot.downloadFile --file_path "${return[file_path]}" --dir "${CIDdir}"
  82. [[ -e ${return[file_path]} ]] && mv ${return[file_path]} ${CID}
  83. local bot_retorno="ID user botgen\n"
  84. bot_retorno+="$LINE\n"
  85. bot_retorno+="Se restauro con exito!!\n"
  86. bot_retorno+="$LINE\n"
  87. bot_retorno+=" FILE ${return[file_path]} \n"
  88. bot_retorno+="$LINE"
  89. ShellBot.sendMessage --chat_id "${message_chat_id[$id]}" \
  90. --reply_to_message_id "${message_message_id[$id]}" \
  91. --text "<i>$(echo -e $bot_retorno)</i>" \
  92. --parse_mode html
  93. return 0
  94. }
  95. msj_add () {
  96. ShellBot.sendMessage --chat_id ${1} \
  97. --text "<i>$(echo -e $bot_retor)</i>" \
  98. --parse_mode html
  99. }
  100. upfile_fun () {
  101. [[ ! -z ${callback_query_message_chat_id[$id]} ]] && var=${callback_query_message_chat_id[$id]} || var=${message_chat_id[$id]}
  102. ShellBot.sendDocument --chat_id $var \
  103. --document @${1} \
  104. #--caption "$(echo -e "$bot_retorno")" \
  105. #--parse_mode html \
  106. #--reply_markup "$(ShellBot.ForceReply)"
  107. #--reply_markup "$(ShellBot.InlineKeyboardMarkup -b "$2")"
  108. }
  109. upimg_fun () {
  110. ShellBot.sendDocument --chat_id $(cat ${CIDdir}/Admin-ID) \
  111. --document @${1} \
  112. #--caption "$(echo -e "$bot_retorno")" \
  113. #--parse_mode html \
  114. #--reply_markup "$(ShellBot.ForceReply)"
  115. #--reply_markup "$(ShellBot.InlineKeyboardMarkup -b "$2")"
  116. }
  117. invalido_fun () {
  118. MSG_id=$((${message_message_id} + 1 ))
  119. [[ ! -z ${callback_query_message_chat_id[$id]} ]] && var=${callback_query_message_chat_id[$id]} || var=${message_chat_id[$id]}
  120. local bot_retorno=" 🎊 𝙱𝚒𝚎𝚗𝚟𝚎𝚗𝚒𝚍𝚘 𝚊𝚕 𝙱𝚘𝚝𝙶𝚎𝚗 𝙰𝙳𝙼 🎊\n"
  121. bot_retorno+="$LINE\n"
  122. bot_retorno+=" COMANDO NO PERMITIDO !!\n Quizas debes usar este /keygen \n O Posiblemente no estas Autorizado, clic aqui /prices o \n Contacta a $(cat < /etc/ADM-db/resell) y adquiere una subscripcion \n Toca aqui para ayuda /ayuda \n"
  123. bot_retorno+="$LINE\n"
  124. ShellBot.sendMessage --chat_id $var \
  125. --text "<i>$(echo -e $bot_retorno)</i>" \
  126. --parse_mode html
  127. sleep 5s
  128. msj_del ${message_message_id}
  129. msj_del ${MSG_id}
  130. return 0
  131. }
  132. send_admin(){
  133. local bot_retorno2="$LINE\n"
  134. bot_retorno2+="🔰 Solicitud de autorizacion 🔰\n"
  135. bot_retorno2+="$LINE\n"
  136. bot_retorno2+="<u>Nombre</u>: ${callback_query_from_first_name}\n"
  137. [[ ! -z ${callback_query_from_username} ]] && bot_retorno2+="<u>Alias</u>: @${callback_query_from_username}\n"
  138. bot_retorno2+="<u>ID</u>: <code>${callback_query_from_id}</code>\n"
  139. bot_retorno2+="$LINE"
  140. bot_retorno="$LINE\n"
  141. bot_retorno+=" 🔰 Bot generador de key 🔰\n"
  142. bot_retorno+=" ⚜ by @ChumoGH ⚜\n"
  143. bot_retorno+="$LINE\n"
  144. bot_retorno+=" ✅ ID enviado al admin ✅\n"
  145. bot_retorno+="$LINE"
  146. comand_boton "atras"
  147. saveID "${callback_query_from_id}"
  148. var=$(cat < ${CIDdir}/Admin-ID)
  149. ShellBot.sendMessage --chat_id $var \
  150. --text "$(echo -e "$bot_retorno2")" \
  151. --parse_mode html \
  152. --reply_markup "$(ShellBot.InlineKeyboardMarkup -b 'botao_save_id')"
  153. return 0
  154. }
  155. msj_fun () {
  156. [[ ! -z ${callback_query_message_chat_id[$id]} ]] && var=${callback_query_message_chat_id[$id]} || var=${message_chat_id[$id]}
  157. ShellBot.sendMessage --chat_id $var \
  158. --text "<i>$(echo -e "$bot_retorno")</i>" \
  159. --parse_mode html
  160. return 0
  161. }
  162. msj_del () {
  163. [[ ! -z ${callback_query_message_chat_id[$id]} ]] && var=${callback_query_message_chat_id[$id]} || var=${message_chat_id[$id]}
  164. ShellBot.deleteMessage --chat_id $var --message_id $1
  165. return 0
  166. }
  167. msj_img () {
  168. #${timg}/id_${usrLOP}.png
  169. local file_id
  170. ShellBot.getFile --file_id "$1"
  171. #ShellBot.downloadFile --file_path "${return[file_path]}" --dir "${timg}/id_${usrLOP}.png"
  172. #[[ -e ${return[file_path]} ]] && mv ${return[file_path]} "${timg}/id_${usrLOP}.png1"
  173. #[[ ! -z ${callback_query_message_chat_id[$id]} ]] && var=${callback_query_message_chat_id[$id]} || var=${message_chat_id[$id]}
  174. #ShellBot.sendPhoto --chat_id $var --photo @${timg}/id_${usrLOP}.png
  175. #ShellBot.deleteMessage --chat_id $var --message_id $1
  176. upimg_fun
  177. local bot_retorno="ID user botgen\n"
  178. bot_retorno+="$LINE\n"
  179. bot_retorno+="Se restauro con exito!!\n"
  180. bot_retorno+="$LINE\n"
  181. bot_retorno+=" FILE ${return[file_path]} \n"
  182. bot_retorno+="$LINE"
  183. ShellBot.sendMessage --chat_id "${message_chat_id[$id]}" \
  184. --reply_to_message_id "${message_message_id[$id]}" \
  185. --text "<i>$(echo -e $bot_retorno)</i>" \
  186. --parse_mode html
  187. return 0
  188. }
  189. msj_chat () {
  190. [[ ! -z ${callback_query_message_chat_id[$id]} ]] && var=${callback_query_message_chat_id[$id]} || var=${message_chat_id[$id]}
  191. ShellBot.sendChatAction --chat_id $var --action typing
  192. #ShellBot.deleteMessage --chat_id $var --message_id $1
  193. return 0
  194. }
  195. msj_donar () {
  196. [[ ! -z ${callback_query_message_chat_id[$id]} ]] && var=${callback_query_message_chat_id[$id]} || var=${message_chat_id[$id]}
  197. ShellBot.sendMessage --chat_id $var \
  198. --text "<i>$(echo -e "$bot_retorno")</i>" \
  199. --parse_mode html \
  200. --reply_markup "$(ShellBot.InlineKeyboardMarkup -b 'botao_donar')"
  201. return 0
  202. }
  203. saveID(){
  204. unset botao_save_id
  205. botao_save_id=''
  206. ShellBot.InlineKeyboardButton --button 'botao_save_id' --line 1 --text "Autorizar ID" --callback_data "/saveid $1"
  207. }
  208. botao_conf=''
  209. botao_user=''
  210. botao_donar=''
  211. unset botao_send_id
  212. botao_send_id=''
  213. ShellBot.InlineKeyboardButton --button 'botao_send_id' --line 1 --text "ENVIAR al ADM" --callback_data '/sendid'
  214. ShellBot.InlineKeyboardButton --button 'botao_send_id' --line 1 --text "menu" --callback_data '/menu'
  215. ShellBot.InlineKeyboardButton --button 'botao_conf' --line 1 --text 'NEW ID' --callback_data '/add'
  216. ShellBot.InlineKeyboardButton --button 'botao_conf' --line 1 --text 'QUITAR 🗑' --callback_data '/del'
  217. ShellBot.InlineKeyboardButton --button 'botao_conf' --line 1 --text 'LISTAR 📋' --callback_data '/list'
  218. ShellBot.InlineKeyboardButton --button 'botao_conf' --line 1 --text ' 🔎 ID' --callback_data '/buscar'
  219. ShellBot.InlineKeyboardButton --button 'botao_conf' --line 2 --text ' ✅ | ❌ ' --callback_data '/power'
  220. ShellBot.InlineKeyboardButton --button 'botao_conf' --line 2 --text 'MENU' --callback_data '/menu'
  221. ShellBot.InlineKeyboardButton --button 'botao_conf' --line 3 --text '🔑 GEN KEY 🔑' --callback_data '/keygen'
  222. ShellBot.InlineKeyboardButton --button 'botao_user' --line 1 --text '🔑 GEN KEY 🔑' --callback_data '/keygen'
  223. ShellBot.InlineKeyboardButton --button 'botao_user' --line 2 --text ' 🧿 Ban|IP 📲' --callback_data '/banIP' # '1' --url "https://t.me/$(cat < /etc/ADM-db/resell)"
  224. ShellBot.InlineKeyboardButton --button 'botao_user' --line 2 --text ' 🛒 CATALOGO 📝 ' --callback_data '1' --url "$(cat < /etc/urlCT)"
  225. ShellBot.InlineKeyboardButton --button 'botao_user' --line 3 --text '💰 DONAR 💰' --callback_data '1' --url "$(cat < /etc/urlDN)"
  226. ShellBot.InlineKeyboardButton --button 'botao_user' --line 3 --text ' 🪀 WTS 📲' --callback_data '1' --url "https://wa.me/$(cat < /etc/numctc)"
  227. ShellBot.InlineKeyboardButton --button 'botao_user' --line 3 --text ' MENU ' --callback_data '/menu'
  228. #ShellBot.InlineKeyboardButton --button 'botao_user' --line 2 --text ' Contacto 📲' --callback_data '1' --url 'https://wa.me/593987072611?text=Hola!,%20ℂ𝕙𝕦𝕞𝕠𝔾ℍ%20Me%20interesa%20Conocer%20más%20sobre%20el%20ADM.'
  229. ShellBot.InlineKeyboardButton --button 'botao_donar' --line 2 --text 'Donar Paypal' --callback_data '1' --url "$(cat < /etc/urlDN)"
  230. ShellBot.InlineKeyboardButton --button 'botao_donar' --line 2 --text 'ACCEDER WHATSAPP' --callback_data '1' --url "https://wa.me/$(cat < /etc/numctc)"
  231. # Ejecutando escucha del bot
  232. while true; do
  233. ShellBot.getUpdates --limit 100 --offset $(ShellBot.OffsetNext) --timeout 30
  234. for id in $(ShellBot.ListUpdates); do
  235. chatuser="$(echo ${message_chat_id[$id]}|cut -d'-' -f2)"
  236. [[ -z $chatuser ]] && chatuser="$(echo ${callback_query_from_id[$id]}|cut -d'-' -f2)"
  237. echo $chatuser >&2
  238. #echo "user id $chatuser"
  239. comando=(${message_text[$id]})
  240. [[ -z $comando ]] && comando=(${callback_query_data[$id]})
  241. #echo "comando $comando"
  242. [[ ! -e "${CIDdir}/Admin-ID" ]] && echo "null" > ${CIDdir}/Admin-ID
  243. permited=$(cat ${CIDdir}/Admin-ID | awk '{print $1}')
  244. comand
  245. done
  246. done