Last active
February 4, 2019 20:02
-
-
Save shellscriptx/ac5375a6c050ecd57c6eddb599225679 to your computer and use it in GitHub Desktop.
bot_service_regras
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 o bot | |
ShellBot.init --token "$bot_token" --monitor --flush | |
# Carregando regras. | |
source root_rules.sh | |
source user_rules.sh | |
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 | |
# Regras | |
ShellBot.setMessageRules --name 'root_rule1' ... | |
ShellBot.setMessageRules --name 'root_rule2' ... | |
# 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 | |
# Regras | |
ShellBot.setMessageRules --name 'user_rule1' ... | |
ShellBot.setMessageRules --name 'user_rule2' ... | |
# FIM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment