Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
Egor Guslyancev | a4e3fc265e |
6
bot.py
6
bot.py
|
@ -17,7 +17,10 @@ import timeout as tmo
|
|||
|
||||
|
||||
# TODO more backends (redis at least)
|
||||
db = db_classes.PickleDB(".db")
|
||||
db = {
|
||||
"pickle": db_classes.PickleDB,
|
||||
# "redis": db_classes.RedisDB,
|
||||
}.get(cr.read("settings.db_type"))(cr.read("settings.db_path"))
|
||||
db.load()
|
||||
CURRENT_VERSION = "v1.0rc9"
|
||||
VERSION = db.read("about.version", CURRENT_VERSION)
|
||||
|
@ -1409,6 +1412,7 @@ def update(forum: int) -> None:
|
|||
|
||||
def update_notify(forum: int) -> None:
|
||||
"Notifies the forum about bot's new version."
|
||||
# TODO changelog
|
||||
bot.reply_to(
|
||||
get_chat(forum),
|
||||
f"Обновился до версии {telebot.formatting.escape_markdown(CURRENT_VERSION)}",
|
||||
|
|
|
@ -7,4 +7,6 @@
|
|||
prod = 0000000000:ooooooooooooooooooooooooooooooooooo
|
||||
|
||||
[settings]
|
||||
notify_period = 120
|
||||
notify_period = 120
|
||||
db_type = pickle
|
||||
db_path = .db
|
|
@ -10,6 +10,15 @@ FIELDS = {
|
|||
"tokens.prod": (str, "" if __debug__ else None, None),
|
||||
"tokens.devel": (str, None if __debug__ else "", None),
|
||||
"settings.notify_period": (int, 120, None),
|
||||
"settings.db_path": (str, ".db", None),
|
||||
"settings.db_type": (
|
||||
str,
|
||||
None,
|
||||
(
|
||||
"pickle",
|
||||
# "redis",
|
||||
),
|
||||
),
|
||||
}
|
||||
|
||||
CONFIG_FILENAME = "config.ini"
|
||||
|
|
Loading…
Reference in New Issue