Skip to content

Commit

Permalink
aiogram1
Browse files Browse the repository at this point in the history
  • Loading branch information
innightwolfsleep committed Sep 13, 2023
1 parent d14149b commit 8b6022d
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 180 deletions.
Empty file added .env
Empty file.
6 changes: 4 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ python-telegram-bot==13.15
pyyaml>=6.0.0
deep-translator>=1.9.2
omegaconf==2.3.0
llama-cpp-python>=0.1.83
llama-cpp-python~=0.1.83
num2words>=0.5.12
transformers>=4.33.0
Pillow>=10.0.0
torch>=2.0.1
backoff>=2.2.1
langchain>=0.0.286
requests>=2.31.0
urllib3>=2.0.4
urllib3>=2.0.4
python-dotenv~=1.0.0
aiogram~=3.0.0
8 changes: 7 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import sys
import os
from threading import Thread
from telegram_bot_wrapper import TelegramBotWrapper
from dotenv import load_dotenv

config_file_path="configs/telegram_config.json"

def run_server(token):
if not token:
load_dotenv()
token = os.environ.get("BOT_TOKEN", "")
# create TelegramBotWrapper instance
# by default, read parameters in telegram_config.cfg
tg_server = TelegramBotWrapper(config_file_path="configs/telegram_config.json")
tg_server = TelegramBotWrapper(config_file_path=config_file_path)
# by default - read token from telegram_token.txt
tg_server.run_telegram_bot(bot_token=str(token))

Expand Down
3 changes: 2 additions & 1 deletion script.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from threading import Thread
from extensions.telegram_bot.TelegramBotWrapper import TelegramBotWrapper

config_file_path="extensions/telegram_bot/configs/telegram_config.json"

def run_server():
# create TelegramBotWrapper instance
# by default, read parameters in telegram_config.cfg
tg_server = TelegramBotWrapper(
config_file_path="extensions/telegram_bot/configs/telegram_config.json"
config_file_path=config_file_path
)
# by default - read token from extensions/telegram_bot/telegram_token.txt
tg_server.run_telegram_bot()
Expand Down
Loading

0 comments on commit 8b6022d

Please sign in to comment.