Skip to content

Instantly share code, notes, and snippets.

@shellscriptx
Last active January 16, 2019 13:48
Show Gist options
  • Save shellscriptx/811fd9cd49d5ddfe59c9083815173712 to your computer and use it in GitHub Desktop.
Save shellscriptx/811fd9cd49d5ddfe59c9083815173712 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Importando API
source ShellBot.sh
# Token do bot
bot_token='<TOKEN_AQUI>'
# Inicializando.
ShellBot.init --token "$bot_token" --monitor --flush
ShellBot.setMessageRules --name 'remover_onu' \
--entitie_type bot_command \
--chat_type private \
--command '/rm_onu' \
--username '<SEU_USUARIO>' \
--user_id '<SEU_ID>' \
--exec './remove_ONU.sh ${@:2}' # Executa o script e passa a lista de serials.
while :
do
# Obtem as atualizações
ShellBot.getUpdates --limit 100 --offset $(ShellBot.OffsetNext) --timeout 30
# Lista o índice das atualizações
for id in $(ShellBot.ListUpdates)
do
# Inicio thread
(
# Gerenciar regras
ShellBot.manageRules --update_id $id
) & # Utilize a thread se deseja que o bot responda a várias requisições simultâneas.
done
done
#FIM
#!/bin/bash
# Lê os argumentos posicionais.
for serial in $@; do
# Executa o "comando' de limpeza passando
# o serial atual.
comandos $serial ...
done
# Envia mensagem de sucesso para a saída padrão que é
# enviada automaticamente ao telegram.
echo "Equipamentos resetados: $@"
@shellscriptx
Copy link
Author

#fdfd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment