Commited backup

This commit is contained in:
2025-07-10 21:02:34 +03:00
parent 952c1001e3
commit da0b80823e
1310 changed files with 254133 additions and 41 deletions

View File

@@ -0,0 +1,40 @@
from .. import loader, utils
from telethon.tl.functions.messages import GetCommonChatsRequest
from telethon.tl.functions.users import GetFullUserRequest
def register(cb):
cb(GetCommonChatsMod())
class GetCommonChatsMod(loader.Module):
"""Общие чаты с пользователем."""
strings = {'name': 'GetCommonChats'}
async def commoncmd(self, message):
"""Используй .common <@ или реплай>, чтобы узнать общие чаты с пользователем."""
args = utils.get_args_raw(message)
reply = await message.get_reply_message()
if not args and not reply:
return await message.edit('<b>Нет аргументов или реплая.</b>')
await message.edit('<b>Считаем...</b>')
try:
if args:
if args.isnumeric():
user = int(args)
user = await message.client.get_entity(user)
else:
user = await message.client.get_entity(args)
else:
user = await utils.get_user(reply)
except ValueError:
return await message.edit('<b>Не удалось найти пользователя.</b>')
msg = f'<b>Общие чаты с {user.first_name}:</b>\n'
user = await message.client(GetFullUserRequest(user.id))
comm = await message.client(GetCommonChatsRequest(user_id=user.user.id, max_id=0, limit=100))
count = 0
m = ''
for chat in comm.chats:
m += f'\n• <a href="tg://resolve?domain={chat.username}">{chat.title}</a> <b>|</b> <code>{chat.id}</code>'
count += 1
msg = f'<b>Общие чаты с {user.user.first_name}: {count}</b>\n'
await message.edit(f'{msg} {m}')