feat: Default skip telegraph account

It will print out the token in local terminal by default.

If Store_Token = True, it will store token in "token_key.json"

View my lite ver and try at <https://github.com/alterxyz/tg_bot_collections_lite>
This commit is contained in:
Alter-xyz
2024-06-24 21:26:44 -04:00
parent e2ffd7fa57
commit 9c8638279e
5 changed files with 141 additions and 219 deletions

View File

@ -19,20 +19,18 @@ from . import *
from telegramify_markdown.customize import markdown_symbol
#### Cohere init ####
import cohere
COHERE_API_KEY = environ.get("COHERE_API_KEY")
TELEGRA_PH_TOKEN = environ.get("TELEGRA_PH_TOKEN")
COHERE_MODEL = "command-r-plus"
if COHERE_API_KEY:
co = cohere.Client(api_key=COHERE_API_KEY)
if TELEGRA_PH_TOKEN:
ph = TelegraphAPI(TELEGRA_PH_TOKEN)
else:
TELEGRA_PH_TOKEN = create_ph_account(
short_name="Answer it", author_name="A Telegram Bot"
)
ph = TelegraphAPI(TELEGRA_PH_TOKEN)
COHERE_MODEL = "command-r-plus"
#### Telegraph init ####
TELEGRA_PH_TOKEN = environ.get("TELEGRA_PH_TOKEN")
ph = TelegraphAPI(TELEGRA_PH_TOKEN)
#### Telegraph done ####
chat_message_dict = ExpiringDict(max_len=100, max_age_seconds=120)
chat_user_dict = ExpiringDict(max_len=100, max_age_seconds=20)
@ -203,7 +201,7 @@ def answer_it_handler(message: Message, bot: TeleBot):
else:
pass
##### Answer #####
##### Telegraph #####
final_answer(latest_message, bot, full, chat_id_list)