Aaaaa
This commit is contained in:
parent
74bc59df12
commit
054a8ce06a
28
bot.py
28
bot.py
|
@ -36,30 +36,6 @@ if (read_db("about.host") is None) and __debug__:
|
|||
|
||||
try:
|
||||
bot = None
|
||||
if __version != __cur_version:
|
||||
import re
|
||||
if path.exists("token"):
|
||||
with open("token", encoding = "utf-8") as fi:
|
||||
for i in fi:
|
||||
i = i.strip()
|
||||
pattern = re.compile("^[\\d]{10}:[\\w\\d\\-\\+\\*]{35}$")
|
||||
matches = pattern.fullmatch(i) is not None
|
||||
if matches:
|
||||
config['tokens']['prod'] = i
|
||||
config.write(filename)
|
||||
break
|
||||
os.remove("token")
|
||||
if path.exists("token.devel"):
|
||||
with open("token.devel", encoding = "utf-8") as fi:
|
||||
for i in fi:
|
||||
i = i.strip()
|
||||
pattern = re.compile("^[\\d]{10}:[\\w\\d\\-\\+\\*]{35}$")
|
||||
matches = pattern.fullmatch(i) is not None
|
||||
if matches:
|
||||
config['tokens']['devel'] = i
|
||||
config.write(filename)
|
||||
break
|
||||
os.remove("token.devel")
|
||||
bot = telebot.TeleBot( config['tokens']['devel' if __debug__ else 'prod'],
|
||||
parse_mode = "MarkdownV2")
|
||||
if bot is None:
|
||||
|
@ -1214,13 +1190,15 @@ def update(forum: int):
|
|||
|
||||
def update_notify(forum: int):
|
||||
bot.reply_to(get_chat(forum),
|
||||
"Обновился до версии " + telebot.formatting.escape_markdown(__version))
|
||||
"Обновился до версии " + telebot.formatting.escape_markdown(__cur_version))
|
||||
|
||||
|
||||
print(__version, __cur_version)
|
||||
if __version != __cur_version:
|
||||
for i in db.keys():
|
||||
try:
|
||||
update_notify(int(i))
|
||||
print("Notified", i)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in New Issue