diff --git a/NoVagonBot.session-journal b/NoVagonBot.session-journal deleted file mode 100644 index eff6abc..0000000 Binary files a/NoVagonBot.session-journal and /dev/null differ diff --git a/main.py b/main.py index 6323177..5817046 100644 --- a/main.py +++ b/main.py @@ -17,12 +17,14 @@ bot = TelegramClient(os.environ['SESSION_NAME'], int(os.environ['API_ID']), async def check_admin(msg): + """Checks if a user is an admin in the chat""" return any([user.id == msg.sender_id async for user in bot.iter_participants(msg.chat_id, filter=types.ChannelParticipantsAdmins)]) @bot.on(events.NewMessage()) async def on_message(msg): + """Handle DM and add chat id to database if not exists""" if msg.is_private: await msg.respond('Я не работаю в личных сообщениях. Добавь меня в группу, для начала работы') raise events.StopPropagation @@ -34,6 +36,7 @@ async def on_message(msg): @bot.on(events.NewMessage(pattern='/help')) async def on_help(msg): + """Send detailed help message""" await msg.reply('Дотупные команды: \n' '/help - помощь\n' '/bs [add/rm] - запретить, разрешить стикерпак в группе, можно написать в ответ на стикер из нужного стикерпака\n' @@ -49,7 +52,8 @@ async def check_user_in_exceptions(user_id, chat_id): @bot.on(events.NewMessage(pattern='/exc')) -async def on_exception(msg): +async def manage_exceptions(msg): + """Manage users, that will be ignored by the bot""" if not await check_admin(msg): await msg.reply('Добавлять пользователей в исключения может только админ') raise events.StopPropagation @@ -113,7 +117,8 @@ async def check_stickerpack_in_banlist(stickerpack_id, chat_id): @bot.on(events.NewMessage(pattern='/bs')) -async def add_stickerpack(msg): +async def manage_stickerpack(msg): + """Add or remove stickerpack from banlist""" if not await check_admin(msg): await msg.reply('Добавлять стикеры в банлист может только админ') raise events.StopPropagation