-
-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathconfig.py
46 lines (40 loc) · 1.47 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from telegram import ReplyKeyboardMarkup
import logging
import yaml
# Enable logging
logging.basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO
)
logger = logging.getLogger(__name__)
fh = logging.FileHandler('main.log')
formatter = logging.Formatter('%(message)s')
fh.setFormatter(formatter)
logger.setLevel(logging.INFO)
logger.addHandler(fh)
# Load data from config.yaml file
with open("config.yaml") as f:
config = yaml.load(f, Loader=yaml.FullLoader)
time_span = config["TIME_SPAN"]
token = config["MAX_TOKEN"]
context_count = config["CONTEXT_COUNT"]
rate_limit = config["RATE_LIMIT"]
notification_channel = config.get("NOTIFICATION_CHANNEL")
image_rate_limit = config["IMAGE_RATE_LIMIT"]
CHOOSING, TYPING_REPLY, TYPING_SYS_CONTENT, TYPING_IMAGE_PROMPT = range(4)
contact_admin = "🆘Help"
start_button = "🚀Start"
set_sys_content_button = "🆔Customize Role"
reset_context_button = "🔃Restart Session"
statistics_button = "📈Statistics"
switch_role_button = "🙋Switch Roles"
language_button = "🔤Language"
image_button = "🖼Image"
reply_keyboard = [
[language_button, image_button, start_button],
[set_sys_content_button, contact_admin, switch_role_button],
[reset_context_button, statistics_button],
]
reply_markup = ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True)
cancel_button = "🚫Cancel"
cancel_keyboard = [[cancel_button]]
cancel_markup = ReplyKeyboardMarkup(cancel_keyboard, one_time_keyboard=True)