dadadd
This commit is contained in:
+11
-9
@@ -15,10 +15,12 @@ if [ ! -f .env ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ─── Carregar .env para verificar token ───────────────────────────────────────
|
||||
set -a
|
||||
source .env
|
||||
set +a
|
||||
# ─── Extrair valores do .env com grep (evita problemas com source) ───────────
|
||||
TELEGRAM_TOKEN=$(grep -E '^TELEGRAM_TOKEN=' .env | head -1 | cut -d '=' -f2- | xargs)
|
||||
TELEGRAM_CHAT_ID=$(grep -E '^TELEGRAM_CHAT_ID=' .env | head -1 | cut -d '=' -f2- | xargs)
|
||||
INTERVALO_MINUTOS=$(grep -E '^INTERVALO_MINUTOS=' .env | head -1 | cut -d '=' -f2- | xargs)
|
||||
SEXO=$(grep -E '^SEXO=' .env | head -1 | cut -d '=' -f2- | xargs)
|
||||
IDADE=$(grep -E '^IDADE=' .env | head -1 | cut -d '=' -f2- | xargs)
|
||||
|
||||
if [ -z "$TELEGRAM_TOKEN" ] || [ "$TELEGRAM_TOKEN" = "seu_token_aqui" ]; then
|
||||
echo "[!] TELEGRAM_TOKEN não configurado no .env"
|
||||
@@ -29,6 +31,8 @@ if [ -z "$TELEGRAM_CHAT_ID" ] || [ "$TELEGRAM_CHAT_ID" = "seu_chat_id_aqui" ]; t
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export TELEGRAM_TOKEN TELEGRAM_CHAT_ID INTERVALO_MINUTOS SEXO IDADE
|
||||
|
||||
# ─── Python virtual env ──────────────────────────────────────────────────────
|
||||
if [ ! -d venv ]; then
|
||||
echo "[+] Criando ambiente virtual Python 3..."
|
||||
@@ -45,10 +49,8 @@ pip install -r requirements.txt -q
|
||||
|
||||
# ─── Ativar /start do bot ────────────────────────────────────────────────────
|
||||
echo "[+] Ativando /start no bot do Telegram..."
|
||||
python3 -c "
|
||||
python3 << 'PYEOF'
|
||||
import asyncio
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
import os
|
||||
from telegram import Bot
|
||||
|
||||
@@ -56,12 +58,12 @@ async def start():
|
||||
bot = Bot(token=os.environ['TELEGRAM_TOKEN'])
|
||||
await bot.send_message(
|
||||
chat_id=os.environ['TELEGRAM_CHAT_ID'],
|
||||
text='🚀 Sistema de ordens iniciado!\n\nO bot está online e começará a enviar ordens em breve.'
|
||||
text='Sistema de ordens iniciado!\n\nO bot esta online e comecara a enviar ordens em breve.'
|
||||
)
|
||||
print('[+] /start enviado com sucesso!')
|
||||
|
||||
asyncio.run(start())
|
||||
"
|
||||
PYEOF
|
||||
|
||||
# ─── Rodar o programa ─────────────────────────────────────────────────────────
|
||||
echo "[+] Iniciando sistema de ordens..."
|
||||
|
||||
Reference in New Issue
Block a user