示例#1
0
from telethon.errors import (ChannelInvalidError, ChannelPrivateError,
                             ChannelPublicGroupNaError, ChatAdminRequiredError)
from telethon.tl.functions.channels import GetFullChannelRequest
from telethon.tl.functions.messages import (GetHistoryRequest,
                                            GetFullChatRequest,
                                            GetExportedChatInvitesRequest)
from telethon.tl.types import (ChannelParticipantCreator,
                               ChatParticipantCreator,
                               MessageActionChannelMigrateFrom,
                               ChannelParticipantsAdmins, Chat, Channel,
                               PeerChannel)
from datetime import datetime
from logging import getLogger

log = getLogger(__name__)
ehandler = EventHandler(log)


async def get_chatinfo(event):
    chat = event.pattern_match.group(1)
    if event.reply_to_msg_id and not chat:
        replied_msg = await event.get_reply_message()
        if replied_msg.from_id and isinstance(replied_msg.from_id,
                                              PeerChannel):
            chat = replied_msg.from_id.channel_id
        elif (replied_msg.fwd_from and replied_msg.fwd_from.from_id
              and isinstance(replied_msg.fwd_from.from_id, PeerChannel)):
            chat = replied_msg.fwd_from.from_id.channel_id
        else:
            await event.edit(msgRep.REPLY_NOT_CHANNEL)
            return None
示例#2
0
# locks
# HyperBot++
# Licensed under the DBBPL
# (C) 2021 githubcatw

from telethon.tl.functions.messages import EditChatDefaultBannedRightsRequest
from telethon.tl.types import ChatBannedRights
from userbot.sysutils.registration import register_cmd_usage, register_module_desc, register_module_info
from userbot.sysutils.event_handler import EventHandler

from os.path import basename

ehandler = EventHandler()
VERSION = "2022.1.2"


@ehandler.on(command="lock", hasArgs=True, outgoing=True)
async def locks(event):
    input_str = event.text.split(" ")[1]
    peer_id = event.chat_id
    msg = None
    media = None
    sticker = None
    gif = None
    gamee = None
    ainline = None
    gpoll = None
    adduser = None
    cpin = None
    changeinfo = None
    if input_str == "msg":