Beispiel #1
0
async def set_no_log_p_m(event):
    if Config.PRIVATE_GROUP_ID is not None:
        chat = await event.get_chat()
        if no_log_pms_sql.is_approved(chat.id):
            no_log_pms_sql.disapprove(chat.id)
            await edit_delete(
                event,
                "`logging of messages from this group has been started`", 5)
Beispiel #2
0
async def set_no_log_p_m(event):
    if config.PM_LOGGR_BOT_API_ID is not None:
        chat = await event.get_chat()
        if not no_log_pms_sql.is_approved(chat.id):
            no_log_pms_sql.approve(chat.id)
            await edit_delete(
                event, "`Logging of messages from this chat has been stopped`",
                5)
Beispiel #3
0
 async def set_no_log_p_m(event):
     if Config.PM_LOGGR_BOT_API_ID is not None:
         event.pattern_match.group(1)
         chat = await event.get_chat()
         if event.is_private and no_log_pms_sql.is_approved(chat.id):
             no_log_pms_sql.disapprove(chat.id)
             await event.edit("Will Log Messages from this chat")
             await asyncio.sleep(3)
             await event.delete()
Beispiel #4
0
 async def set_no_log_p_m(event):
     if Config.PM_LOGGR_BOT_API_ID is not None:
         event.pattern_match.group(1)
         chat = await event.get_chat()
         if event.is_private:
             if no_log_pms_sql.is_approved(chat.id):
                 no_log_pms_sql.disapprove(chat.id)
                 await event.edit("Bu sohbetten Mesaj Günlüğe Kaydedilecek")
                 await asyncio.sleep(3)
                 await event.delete()
Beispiel #5
0
async def on_new_private_message(event):
    if Config.PM_LOGGR_BOT_API_ID is None:
        return

    if not event.is_private:
        return

    message_text = event.message.message
    message_media = event.message.media
    message_id = event.message.id
    message_to_id = event.message.to_id
    chat_id = event.chat_id
    # logger.info(chat_id)

    current_message_text = message_text.lower()
    if BAALAJI_TG_USER_BOT in current_message_text or \
        TG_COMPANION_USER_BOT in current_message_text or \
        UNIBORG_USER_BOT_NO_WARN in current_message_text:
        # userbot's should not reply to other userbot's
        # https://core.telegram.org/bots/faq#why-doesn-39t-my-bot-see-messages-from-other-bots
        return

    sender = await event.client.get_entity(chat_id)
    if chat_id == borg.uid:
        # don't log Saved Messages
        return
    if sender.bot:
        # don't log bots
        return
    if sender.verified:
        # don't log verified accounts
        return

    """if not pmpermit_sql.is_approved(chat_id):
        # pm permit
        await do_pm_permit_action(chat_id, event)"""

    if not no_log_pms_sql.is_approved(chat_id):
        # log pms
        await do_log_pm_action(chat_id, event, message_text, message_media)
Beispiel #6
0
async def log_tagged_messages(event):
    hmm = await event.get_chat()
    if no_log_pms_sql.is_approved(hmm.id):
        return
    if not Config.PM_LOGGR_BOT_API_ID:
        return
    from .afk import USERAFK_ON

    if "on" in USERAFK_ON:
        return
    try:
        if (await event.get_sender()).bot:
            return
    except:
        pass
    full = None
    try:
        full = await event.client.get_entity(event.message.from_id)
    except:
        pass
    messaget = media_type(event)
    resalt = f"#TAGS \n<b>Group : </b><code>{hmm.title}</code>"
    if full is not None:
        resalt += (
            f"\n<b>From : </b> 👤{_format.htmlmentionuser(full.first_name , full.id)}"
        )
    if messaget is not None:
        resalt += f"\n<b>Message type : </b><code>{messaget}</code>"
    else:
        resalt += f"\n<b>Message : </b>{event.message.message}"
    resalt += f"\n<b>Message link: </b><a href = 'https://t.me/c/{hmm.id}/{event.message.id}'> link</a>"
    await asyncio.sleep(3)
    if not event.is_private:
        await event.client.send_message(
            Config.PM_LOGGR_BOT_API_ID,
            resalt,
            parse_mode="html",
            link_preview=False,
        )
Beispiel #7
0
async def log_tagged_messages(event):
    hmm = await event.get_chat()
    if no_log_pms_sql.is_approved(hmm.id):
        return
    if not Config.PM_LOGGR_BOT_API_ID:
        return
    from .afk import USERAFK_ON

    if "on" in USERAFK_ON:
        return
    try:
        if (await event.get_sender()).bot:
            return
    except:
        pass
    await asyncio.sleep(5)
    if not event.is_private:
        await event.client.send_message(
            Config.PM_LOGGR_BOT_API_ID,
            f"#TAGS \n<b>Group : </b><code>{hmm.title}</code>\
                        \n<b>Message : </b><a href = 'https://t.me/c/{hmm.id}/{event.message.id}'> link</a>",
            parse_mode="html",
            link_preview=False,
        )
Beispiel #8
0
 async def on_new_private_message(event):
     if Config.PM_LOGGR_BOT_API_ID is None:
         return
     if not event.is_private:
         return
     if event.from_id == bot.uid:
         return
     chat_id = event.from_id
     # logger.info(chat_id)
     sender = await event.client.get_entity(chat_id)
     if chat_id == borg.uid:
         # don't log Saved Messages
         return
     if sender.bot:
         # don't log bots
         return
     if sender.verified:
         # don't log verified accounts
         return
     if not no_log_pms_sql.is_approved(chat_id):
         message_text = event.message.message
         message_media = event.message.media
         # log pms
         await do_log_pm_action(chat_id, event, message_text, message_media)