This commit is contained in:
@@ -10,6 +10,17 @@ jobs:
|
|||||||
container:
|
container:
|
||||||
image: catthehacker/ubuntu:act-latest
|
image: catthehacker/ubuntu:act-latest
|
||||||
options: --privileged # Required for Docker-in-Docker
|
options: --privileged # Required for Docker-in-Docker
|
||||||
|
environment:
|
||||||
|
BOT_TOKEN:
|
||||||
|
from_secret: bot_token
|
||||||
|
AUTHORIZED_USER_ID:
|
||||||
|
from_secret: authorized_user_id
|
||||||
|
NTFY_AUTH_HEADER:
|
||||||
|
from_secret: ntfy_auth_header
|
||||||
|
KUMA_API_PASSWORD:
|
||||||
|
from_secret: kuma_api_password
|
||||||
|
TORRENT_API_PASSWORD:
|
||||||
|
from_secret: torrent_api_password
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -40,5 +51,5 @@ jobs:
|
|||||||
--data '{
|
--data '{
|
||||||
"prune": false,
|
"prune": false,
|
||||||
"pullImage": true,
|
"pullImage": true,
|
||||||
"stackFileContent": "version: '\''3.8'\''\nservices:\n jarvis:\n image: gitea.abzk.fr/mrzaiko/jarvis:latest\n container_name: jarvis"
|
"stackFileContent": "version: '\''3.8'\''\nservices:\n jarvis:\n image: gitea.abzk.fr/mrzaiko/jarvis:latest\n container_name: jarvis\n volumes:\n - /home/portainer/docker-config/local_stuff/jarvis/:/app/config"
|
||||||
}'
|
}'
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,3 +5,5 @@ tmp/
|
|||||||
venv/
|
venv/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.db
|
*.db
|
||||||
|
|
||||||
|
.env
|
||||||
|
|||||||
20
config.py
Normal file
20
config.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
|
||||||
|
load_dotenv() # Loads variables from .env into environment
|
||||||
|
|
||||||
|
|
||||||
|
def get_env_var(name: str) -> str:
|
||||||
|
value = os.getenv(name)
|
||||||
|
if value is None:
|
||||||
|
raise EnvironmentError(f"Missing required environment variable: {name}")
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
BOT_TOKEN = get_env_var("BOT_TOKEN")
|
||||||
|
AUTHORIZED_USER_ID = int(get_env_var("AUTHORIZED_USER_ID"))
|
||||||
|
NTFY_AUTH_HEADER = get_env_var("NTFY_AUTH_HEADER")
|
||||||
|
KUMA_API_PASSWORD = get_env_var("KUMA_API_PASSWORD")
|
||||||
|
TORRENT_API_PASSWORD = get_env_var("TORRENT_API_PASSWORD")
|
||||||
16
main.py
16
main.py
@@ -10,12 +10,16 @@ import api.ntfy as ntfy
|
|||||||
|
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
from config import (
|
||||||
|
BOT_TOKEN,
|
||||||
|
AUTHORIZED_USER_ID,
|
||||||
|
NTFY_AUTH_HEADER,
|
||||||
|
KUMA_API_PASSWORD,
|
||||||
|
TORRENT_API_PASSWORD,
|
||||||
|
)
|
||||||
|
|
||||||
TOKEN = "7396669954:AAH8_I0Y-qg3j_LfbUdRTOLPDKh80NdijMo"
|
|
||||||
AUTHORIZED_USER_ID = 634303772 # Replace with your Telegram user ID
|
|
||||||
NTFY_SERVER = "http://192.168.1.2:54720"
|
NTFY_SERVER = "http://192.168.1.2:54720"
|
||||||
NTFY_AUTH_HEADER = "tk_cdmwd6ix255g3qgo4dx3r0gakw4y3"
|
DB_PATH = "config/subscriptions.db"
|
||||||
DB_PATH = "subscriptions.db"
|
|
||||||
|
|
||||||
|
|
||||||
# --- Command Handlers ---
|
# --- Command Handlers ---
|
||||||
@@ -202,9 +206,9 @@ def main():
|
|||||||
print("Starting Jarvis...")
|
print("Starting Jarvis...")
|
||||||
|
|
||||||
# Initiate api
|
# Initiate api
|
||||||
kuma_api = kuma.KumaAPI("http://192.168.1.2:36667", "k!PTfyvoIJho9o*gX6F1")
|
kuma_api = kuma.KumaAPI("http://192.168.1.2:36667", KUMA_API_PASSWORD)
|
||||||
torrent_api = torrent.TorrentApi(
|
torrent_api = torrent.TorrentApi(
|
||||||
"http://192.168.1.17:8112", "tMHNjrJr7nhjyhJrYsahi4anq2h6LJ", username="MrZaiko"
|
"http://192.168.1.17:8112", TORRENT_API_PASSWORD, username="MrZaiko"
|
||||||
)
|
)
|
||||||
|
|
||||||
ntfy_api = ntfy.NtfyAPI(DB_PATH, NTFY_SERVER, NTFY_AUTH_HEADER, AUTHORIZED_USER_ID)
|
ntfy_api = ntfy.NtfyAPI(DB_PATH, NTFY_SERVER, NTFY_AUTH_HEADER, AUTHORIZED_USER_ID)
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ python-qbittorrent
|
|||||||
uptime-kuma-api
|
uptime-kuma-api
|
||||||
python-telegram-bot
|
python-telegram-bot
|
||||||
requests
|
requests
|
||||||
|
dotenvv
|
||||||
|
|||||||
Reference in New Issue
Block a user