1.3 Новые определения типов
This commit is contained in:
19
BotLibrary/analytics/type_chat.py
Normal file
19
BotLibrary/analytics/type_chat.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# BotLibrary/analytics/type_chat.py
|
||||||
|
# Определение типа чата
|
||||||
|
|
||||||
|
from aiogram import types
|
||||||
|
|
||||||
|
# Настройка экспорта в модули
|
||||||
|
__all__ = ("type_chat",)
|
||||||
|
|
||||||
|
# Проверка на тип чата
|
||||||
|
async def type_chat(message: types.Message):
|
||||||
|
chat_type = message.chat.type
|
||||||
|
if chat_type == "private":
|
||||||
|
return "Личный"
|
||||||
|
elif chat_type == "group" or chat_type == "supergroup":
|
||||||
|
return "Группа"
|
||||||
|
elif chat_type == "channel":
|
||||||
|
return "Канал"
|
||||||
|
else:
|
||||||
|
return "Неизвестный тип чата."
|
||||||
@@ -3,7 +3,6 @@ from aiogram.types import ContentType, Message
|
|||||||
# Настройка экспорта из модуля
|
# Настройка экспорта из модуля
|
||||||
__all__ = ("types_message",)
|
__all__ = ("types_message",)
|
||||||
|
|
||||||
|
|
||||||
# Функция определения типа сообщения
|
# Функция определения типа сообщения
|
||||||
def types_message(message: Message) -> str:
|
def types_message(message: Message) -> str:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user