mirror of
https://github.com/civsocit/olgram.git
synced 2023-07-22 01:29:12 +03:00
При создании группового чата он добавляется в список olgram
This commit is contained in:
parent
dcee7a98df
commit
b38834b265
@ -89,6 +89,18 @@ async def receive_invite(message: types.Message):
|
|||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
async def receive_group_create(message: types.Message):
|
||||||
|
bot = db_bot_instance.get()
|
||||||
|
|
||||||
|
chat, _ = await GroupChat.get_or_create(chat_id=message.chat.id,
|
||||||
|
defaults={"name": message.chat.full_name})
|
||||||
|
chat.name = message.chat.full_name
|
||||||
|
await chat.save()
|
||||||
|
if chat not in await bot.group_chats.all():
|
||||||
|
await bot.group_chats.add(chat)
|
||||||
|
await bot.save()
|
||||||
|
|
||||||
|
|
||||||
async def receive_left(message: types.Message):
|
async def receive_left(message: types.Message):
|
||||||
bot = db_bot_instance.get()
|
bot = db_bot_instance.get()
|
||||||
if message.left_chat_member.id == message.bot.id:
|
if message.left_chat_member.id == message.bot.id:
|
||||||
@ -139,6 +151,7 @@ class CustomRequestHandler(WebhookRequestHandler):
|
|||||||
dp.register_message_handler(receive_invite, content_types=[types.ContentType.NEW_CHAT_MEMBERS])
|
dp.register_message_handler(receive_invite, content_types=[types.ContentType.NEW_CHAT_MEMBERS])
|
||||||
dp.register_message_handler(receive_left, content_types=[types.ContentType.LEFT_CHAT_MEMBER])
|
dp.register_message_handler(receive_left, content_types=[types.ContentType.LEFT_CHAT_MEMBER])
|
||||||
dp.register_message_handler(receive_migrate, content_types=[types.ContentType.MIGRATE_TO_CHAT_ID])
|
dp.register_message_handler(receive_migrate, content_types=[types.ContentType.MIGRATE_TO_CHAT_ID])
|
||||||
|
dp.register_message_handler(receive_group_create, content_types=[types.ContentType.GROUP_CHAT_CREATED])
|
||||||
|
|
||||||
return dp
|
return dp
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user