Last active
January 16, 2019 13:48
-
-
Save shellscriptx/811fd9cd49d5ddfe59c9083815173712 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: $@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#fdfd