Пример #1
0
async def auto_accept(event):
    """ İlk mesajı atan sizseniz otomatik olarak onaylanır. """
    UNAPPROVED_MSG = DEF_UNAPPROVED_MSG
    if 'PM_USER_MSG' in globals() and PM_USER_MSG:
        UNAPPROVED_MSG = PM_USER_MSG
    if not PM_AUTO_BAN:
        return
    self_user = await event.client.get_me()
    if event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not (
            await event.get_sender()).bot:
        try:
            from sedenbot.moduller.sql_helper.pm_permit_sql import approve, is_approved
        except:
            return

        chat = await event.get_chat()
        if isinstance(chat, User):
            if is_approved(event.chat_id) or chat.bot:
                return
            async for message in event.client.iter_messages(event.chat_id,
                                                            reverse=True,
                                                            limit=1):
                if message.message is not UNAPPROVED_MSG and message.from_id == self_user.id:
                    try:
                        approve(event.chat_id)
                    except IntegrityError:
                        return

                if is_approved(event.chat_id) and BOTLOG:
                    await event.client.send_message(
                        BOTLOG_CHATID,
                        "#OTOMATIK-ONAYLANDI\n" + "Kullanıcı: " +
                        f"[{chat.first_name}](tg://user?id={chat.id})",
                    )
Пример #2
0
async def approvepm(apprvpm):
    UNAPPROVED_MSG = DEF_UNAPPROVED_MSG
    if 'PM_USER_MSG' in globals() and PM_USER_MSG:
        UNAPPROVED_MSG = PM_USER_MSG
    """ .approve komutu herhangi birine PM atabilme izni verir. """
    try:
        from sedenbot.moduller.sql_helper.pm_permit_sql import approve
    except:
        await apprvpm.edit("`Bot Non-SQL modunda çalışıyor!!`")
        return

    if apprvpm.reply_to_msg_id:
        reply = await apprvpm.get_reply_message()
        replied_user = await apprvpm.client.get_entity(reply.from_id)
        aname = replied_user.id
        name0 = str(replied_user.first_name)
        uid = replied_user.id

    else:
        aname = await apprvpm.client.get_entity(apprvpm.chat_id)
        if not isinstance(aname, User):
            await apprvpm.edit(
                "`Şu an bir PM'de değilsin ve birinin mesajını alıntılamadın.`"
            )
            return
        name0 = aname.first_name
        uid = apprvpm.chat_id

    try:
        approve(uid)
    except IntegrityError:
        await apprvpm.edit(
            "`Kullanıcı halihazırda PM gönderebiliyor olmalıdır.`")
        return

    await apprvpm.edit(
        f"[{name0}](tg://user?id={uid}) `kişisi PM gönderebilir!`")

    async for message in apprvpm.client.iter_messages(apprvpm.chat_id,
                                                      from_user='******',
                                                      search=UNAPPROVED_MSG):
        await message.delete()

    if BOTLOG:
        await apprvpm.client.send_message(
            BOTLOG_CHATID,
            "#ONAYLANDI\n" + "Kullanıcı: " + f"[{name0}](tg://user?id={uid})",
        )