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.
This commit is contained in:
marco
2026-09-04 09:24:47 -03:00
parent c21d105f9b
commit c461a0dba5
3 changed files with 123 additions and 0 deletions
+4
View File
@@ -9,5 +9,9 @@ IDADE=65
# Intervalo entre ordens em minutos # Intervalo entre ordens em minutos
INTERVALO_MINUTOS=1 INTERVALO_MINUTOS=1
# Horário de funcionamento (formato HH:MM, 24h)
HORA_INICIO=08:00
HORA_FIM=22:00
# Tipos de ordens (separados por vírgula) # Tipos de ordens (separados por vírgula)
TIPOS_ORDENS="enfie um dedo no cú, alise a cabeça do pau, masturbe-se, fique pelado, abaixe a cueca, arregace a bunda e mostre o cú, vá pelado na área de serviço e mostre o cú, enfie um plug fino no cú, enfie um plug médio no cú, enfie um plug grosso no cú, enfie dois dedos no cú, faça eding e não goze, exponha a cabeça do pau, fique de quatro na cama, masturbe com o pau puxado para trás das pernas, exponha bem a bunda e o cú, apenas pelado, exibir bunda e cú, edging completo, piru no trabalho, piru sem gozar, ruined orgasm" TIPOS_ORDENS="enfie um dedo no cú, alise a cabeça do pau, masturbe-se, fique pelado, abaixe a cueca, arregace a bunda e mostre o cú, vá pelado na área de serviço e mostre o cú, enfie um plug fino no cú, enfie um plug médio no cú, enfie um plug grosso no cú, enfie dois dedos no cú, faça eding e não goze, exponha a cabeça do pau, fique de quatro na cama, masturbe com o pau puxado para trás das pernas, exponha bem a bunda e o cú, apenas pelado, exibir bunda e cú, edging completo, piru no trabalho, piru sem gozar, ruined orgasm"
+97
View File
@@ -0,0 +1,97 @@
# Deploy no Debian 12
## 1. Pré-requisitos
```bash
sudo apt update && sudo apt upgrade -y
sudo apt install -y python3 python3-pip python3-venv git
```
## 2. Clonar o repositório
```bash
git clone <url-do-repo> /opt/jogo3
cd /opt/jogo3/app
```
## 3. Configurar variáveis de ambiente
```bash
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
```bash
chmod +x iniciar.sh
./iniciar.sh
```
Pressione `Ctrl+C` para parar.
## 5. Service systemd (auto-start + auto-restart)
```bash
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
```
```bash
sudo systemctl daemon-reload
sudo systemctl enable jogo3
sudo systemctl start jogo3
```
## 6. Comandos úteis
```bash
# 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:
```bash
sudo systemctl restart jogo3
```
+22
View File
@@ -24,6 +24,13 @@ SEXO = os.getenv("SEXO", "masculino").strip().lower()
IDADE = int(os.getenv("IDADE", "30")) IDADE = int(os.getenv("IDADE", "30"))
INTERVALO = int(os.getenv("INTERVALO_MINUTOS", "5")) INTERVALO = int(os.getenv("INTERVALO_MINUTOS", "5"))
HORA_INICIO = os.getenv("HORA_INICIO", "00:00").strip()
HORA_FIM = os.getenv("HORA_FIM", "23:59").strip()
def dentro_do_horario() -> bool:
agora = datetime.now().strftime("%H:%M")
return HORA_INICIO <= agora <= HORA_FIM
ORDENS_PATH = os.path.join(os.path.dirname(__file__), "ordens.json") ORDENS_PATH = os.path.join(os.path.dirname(__file__), "ordens.json")
# ─── Substituições para sexo feminino ────────────────────────────────────────── # ─── Substituições para sexo feminino ──────────────────────────────────────────
@@ -108,10 +115,25 @@ async def loop_principal():
bot = Bot(token=TOKEN) bot = Bot(token=TOKEN)
await cmd_start(ordens) await cmd_start(ordens)
agora = datetime.now().strftime("%H:%M")
if not dentro_do_horario():
log.info("Horário atual %s fora da janela %s-%s. Aguardando...", agora, HORA_INICIO, HORA_FIM)
await bot.send_message(
chat_id=CHAT_ID,
text=f"Horário atual ({agora}) fora da janela de ordens ({HORA_INICIO}-{HORA_FIM}).\n"
f"As ordens serão retomadas automaticamente às {HORA_INICIO}."
)
await asyncio.sleep(INTERVALO * 60) await asyncio.sleep(INTERVALO * 60)
ordem_index = 0 ordem_index = 0
while True: while True:
if not dentro_do_horario():
log.info("Fora do horário de funcionamento (%s-%s). Aguardando...", HORA_INICIO, HORA_FIM)
await asyncio.sleep(60)
continue
ordem = ordens[ordem_index % len(ordens)] ordem = ordens[ordem_index % len(ordens)]
ordem_adaptada = adaptar_ordem(ordem) ordem_adaptada = adaptar_ordem(ordem)