Files
Jogo3/DEPLOY.md
T
marco c461a0dba5 feat(bot): add operating hours window configuration and enforcement
Adds HORA_INICIO and HORA_FIM environment variables to define the daily
operating window for order sending. Implements dentro_do_horario() function
to validate if current time falls within the configured range. The bot now
pauses order sending outside the operating window and sends a notification
to the chat, resuming automatically at HORA_INICIO.

Includes DEPLOY.md documentation with Debian 12 deployment instructions
and systemd service configuration for auto-start and auto-restart.
2026-09-04 09:24:47 -03:00

1.6 KiB

Deploy no Debian 12

1. Pré-requisitos

sudo apt update && sudo apt upgrade -y
sudo apt install -y python3 python3-pip python3-venv git

2. Clonar o repositório

git clone <url-do-repo> /opt/jogo3
cd /opt/jogo3/app

3. Configurar variáveis de ambiente

cp .env.example .env
nano .env

Preencha:

  • TELEGRAM_TOKEN — token do BotFather
  • TELEGRAM_CHAT_ID — seu chat ID (ou grupo)
  • SEXO — masculino ou feminino
  • IDADE — sua idade
  • INTERVALO_MINUTOS — intervalo entre ordens
  • HORA_INICIO — horário de início (ex: 08:00, formato 24h)
  • HORA_FIM — horário de fim (ex: 22:00)
  • TIPOS_ORDENS — lista separada por vírgulas

4. Testar manualmente

chmod +x iniciar.sh
./iniciar.sh

Pressione Ctrl+C para parar.

5. Service systemd (auto-start + auto-restart)

sudo tee /etc/systemd/system/jogo3.service > /dev/null << 'EOF'
[Unit]
Description=Jogo3 - Sistema Automatico de Ordens Telegram
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/opt/jogo3/app
ExecStart=/opt/jogo3/app/iniciar.sh
Restart=always
RestartSec=10
Environment=PYTHONUNBUFFERED=1

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable jogo3
sudo systemctl start jogo3

6. Comandos úteis

# Status
sudo systemctl status jogo3

# Logs
sudo journalctl -u jogo3 -f

# Parar
sudo systemctl stop jogo3

# Reiniciar
sudo systemctl restart jogo3

# Desabilitar auto-start
sudo systemctl disable jogo3

7. Atualizar ordens

Edite ordens.json, depois reinicie o service:

sudo systemctl restart jogo3