From 7774f08180b6772c5375ba865cdd3b30a27da1d5 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 30 Oct 2023 23:00:56 +0700 Subject: [PATCH] make it more cool --- config.py | 2 ++ main.py | 1 + requirements.txt | 2 ++ routes/info_bot.py | 18 +++++++++++++++--- routes/rewards.py | 1 - utils.py | 4 ++-- 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/config.py b/config.py index 2ef913c..2aa9ad9 100644 --- a/config.py +++ b/config.py @@ -1,5 +1,6 @@ from vkbottle.user import UserLabeler, Message, User +TOKEN = "test" bl = UserLabeler() user = User(token=TOKEN) @@ -7,6 +8,7 @@ user = User(token=TOKEN) prefix_bot = "хуй" prefix_dd = "дд" + async def edit_message( message: Message, text: str = '', diff --git a/main.py b/main.py index 672a8a6..9ad1a5b 100644 --- a/main.py +++ b/main.py @@ -8,5 +8,6 @@ logger.add(sys.stderr, format="{time} {level} {message}", filter="my_module", le for custom_labeler in labelers: user.labeler.load(custom_labeler) + if __name__ == "__main__": user.run_forever() diff --git a/requirements.txt b/requirements.txt index 0e56e80..b4d2e76 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,4 @@ +gitpython==3.1.40 loguru==0.7.2 +pytz==2023.3.post1 vkbottle==4.3.12 diff --git a/routes/info_bot.py b/routes/info_bot.py index afb2782..6f16818 100644 --- a/routes/info_bot.py +++ b/routes/info_bot.py @@ -1,11 +1,23 @@ +import pytz +import git + from custom_rules.permission import Permission from vkbottle.user import Message -from config import bl, edit_message, prefix_bot +from config import bl, edit_message, prefix_bot from utils import rewards_list - @bl.message(Permission(), text=[prefix_bot + " бот"]) async def about(message: Message): + repo = git.Repo(search_parent_directories=True) + version = repo.head.object.hexsha[:7] + version_date = repo.head.object.committed_datetime.astimezone(pytz.timezone("Europe/Moscow")) + + f'Текущая версия бота: {version} от {version_date}' + await edit_message(message, - "Информация о боте 🤖:\n\n Название бота 🤖: dize_lp\n Версия бота ⚙️: v0.1\n Создатель бота 👨‍🦱: @dize_dev(Илдырым Денница)\n Достижения🏆: " + rewards_list[1]) + "Информация о боте 🤖:\n\n" + "Название бота 🤖: dize_lp\n" + f"Версия бота ⚙️: {version} от {version_date}\n" + "Создатель бота 👨‍🦱: @dize_dev (Илдырым Денница)\n" + f"Достижения🏆: {rewards_list[1]}") diff --git a/routes/rewards.py b/routes/rewards.py index a4d2cff..eb414d9 100644 --- a/routes/rewards.py +++ b/routes/rewards.py @@ -3,7 +3,6 @@ from vkbottle.user import Message from config import bl, edit_message, prefix_bot from utils import rewards_list - listToStr = ' '.join(map(str, rewards_list)) diff --git a/utils.py b/utils.py index 5224d58..6590dcf 100644 --- a/utils.py +++ b/utils.py @@ -2,7 +2,7 @@ rewards_list = [ "Первооткрыватель 🎓\n", "Создатель ⭐\n", "Администратор 👨🏻‍💼\n", - "Модератоор 🛡️\n", - "Иследователь 🔎\n", + "Модератор 🛡️\n", + "Исследователь 🔎\n", "Спонсор 💸\n", ]