Files
limoka/MuRuLOSE/HikkaModulesRepo/ChannelCheck.py
2025-07-10 21:02:34 +03:00

63 lines
2.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

__version__ = (0, 0, 5)
from telethon.tl.types import Message, ChatAdminRights
from telethon import functions
import asyncio
from .. import loader, utils
import re
"""
███ ███ ██ ██ ██████ ██ ██ ██ ██████ ███████ ███████
████ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ████ ██ ██ ██ ██████ ██ ██ ██ ██ ██ ███████ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██████ ██ ██ ██████ ███████ ██████ ███████ ███████
ChannelCheck
📜 Licensed under the GNU AGPLv3
"""
# meta desc: desc
# meta developer: @BruhHikkaModules
@loader.tds
class ChannelCheck(loader.Module):
"""Модуль для получении информации о нахождении человека в канале."""
strings = {
"name": "ChannelCheck",
"not_channel": f" Not in the channel ",
"in_channel": f" Located in the channel ",
}
strings_ru = {
"not_channel": f" Не находится в канале ",
"in_channel": f" Находится в канале ",
}
@loader.command()
async def checksub(self, message):
"""[айди или юзернейм канала] [юзернейм или айди человека]- Проверить, находится ли человек в указанном вами канале"""
status = None
args = utils.get_args_raw(message)
user_info = args.split()[1]
channel_info = args.split()[0]
channel = await self.client.get_entity(channel_info)
user = await self.client.get_entity(user_info)
check_user = await self.client.get_participants(channel)
check_member = any(participant.id == user.id for participant in check_user)
if check_member:
status = self.strings["in_channel"]
await utils.answer(
message, f"🥳 <b>{user.username}</b>{status}<b>{channel.title}</b>"
)
else:
status = self.strings["not_channel"]
await utils.answer(
message, f"😓 <b>{user.username}</b>{status}<b>{channel.title}</b>"
)