コード例 #1
0
ファイル: log_channel.py プロジェクト: Col-Serra/SaitamaRobot
        def log_action(
            update: Update,
            context: CallbackContext,
            job_queue: JobQueue = None,
            *args,
            **kwargs,
        ):
            if not job_queue:
                result = func(update, context, *args, **kwargs)
            else:
                result = func(update, context, job_queue, *args, **kwargs)

            chat = update.effective_chat
            message = update.effective_message

            if result and isinstance(result, str):
                datetime_fmt = "%H:%M - %d-%m-%Y"
                result += f"\n<b>Event Stamp</b>: <code>{datetime.utcnow().strftime(datetime_fmt)}</code>"

                if message.chat.type == chat.SUPERGROUP and message.chat.username:
                    result += f'\n<b>Link:</b> <a href="https://t.me/{chat.username}/{message.message_id}">click here</a>'
                log_chat = sql.get_chat_log_channel(chat.id)
                if log_chat:
                    send_log(context, log_chat, chat.id, result)

            return result
コード例 #2
0
        def log_action(bot: Bot, update: Update, job_queue: JobQueue = None, *args, **kwargs):

            if not job_queue:
                result = func(bot, update, *args, **kwargs)
            else:
                result = func(bot, update, job_queue, *args, **kwargs)

            chat = update.effective_chat
            message = update.effective_message

            if result:
                datetime_fmt = "%H:%M - %d-%m-%Y"
                result += f"\n<b>Etkinlik Damgası</b>: <code>{datetime.utcnow().strftime(datetime_fmt)}</code>"

                if message.chat.type == chat.SUPERGROUP and message.chat.username:
                    result += f'\n<b>Link:</b> <a href="https://t.me/{chat.username}/{message.message_id}">click here</a>'
                log_chat = sql.get_chat_log_channel(chat.id)
                if log_chat:
                    send_log(bot, log_chat, chat.id, result)
            elif result == "" or not result:
                pass
            else:
                LOGGER.warning("%s kaydedilebilir olarak ayarlandı, ancak iade bildirimi yoktu.", func)

            return result
コード例 #3
0
ファイル: log_channel.py プロジェクト: xditya/SaitamaRobot
        def log_action(bot: Bot,
                       update: Update,
                       job_queue: JobQueue = None,
                       *args,
                       **kwargs):

            if not job_queue:
                result = func(bot, update, *args, **kwargs)
            else:
                result = func(bot, update, job_queue, *args, **kwargs)

            chat = update.effective_chat
            message = update.effective_message

            if result:
                datetime_fmt = "%H:%M - %d-%m-%Y"
                result += f"\n<b>Event Stamp</b>: <code>{datetime.utcnow().strftime(datetime_fmt)}</code>"

                if message.chat.type == chat.SUPERGROUP and message.chat.username:
                    result += f'\n<b>Link:</b> <a href="https://t.me/{chat.username}/{message.message_id}">click here</a>'
                log_chat = sql.get_chat_log_channel(chat.id)
                if log_chat:
                    send_log(bot, log_chat, chat.id, result)
            elif result == "" or not result:
                pass
            else:
                LOGGER.warning(
                    "%s was set as loggable, but had no return statement.",
                    func)

            return result
コード例 #4
0
    def logging(bot: Bot, update: Update):

        message = update.effective_message
        chat = update.effective_chat

        log_channel = sql.get_chat_log_channel(chat.id)
        if log_channel:
            log_channel_info = bot.get_chat(log_channel)
            message.reply_text(f"Bu grupta günlüklerinin tümü var:"
                               f" {escape_markdown(log_channel_info.title)} (`{log_channel}`)",
                               parse_mode=ParseMode.MARKDOWN)

        else:
            message.reply_text("Bu grup için günlük kanalı ayarlanmadı!")
コード例 #5
0
    def logging(update: Update, context: CallbackContext):
        bot = context.bot
        message = update.effective_message
        chat = update.effective_chat

        log_channel = sql.get_chat_log_channel(chat.id)
        if log_channel:
            log_channel_info = bot.get_chat(log_channel)
            message.reply_text(
                f"This group has all it's logs sent to:"
                f" {escape_markdown(log_channel_info.title)} (`{log_channel}`)",
                parse_mode=ParseMode.MARKDOWN)

        else:
            message.reply_text("No log channel has been set for this group!")
コード例 #6
0
ファイル: log_channel.py プロジェクト: Ryomen-Sukuna/Kai
        def log_action(update, context, *args, **kwargs):
            result = func(update, context, *args, **kwargs)
            chat = update.effective_chat  # type: Optional[Chat]
            message = update.effective_message  # type: Optional[Message]

            if result:
                datetime_fmt = "%H:%M - %d-%m-%Y"
                result += f"\n<b>Event Stamp</b>: <code>{datetime.utcnow().strftime(datetime_fmt)}</code>"

                if message.chat.type == chat.SUPERGROUP and message.chat.username:
                    result += f'\n<b>Link:</b> <a href="https://t.me/{chat.username}/{message.message_id}">click here</a>'
                log_chat = sql.get_chat_log_channel(chat.id)
                if log_chat:
                    send_log(context, log_chat, chat.id, result)

            return result
コード例 #7
0
ファイル: log_channel.py プロジェクト: Col-Serra/SaitamaRobot
 def __chat_settings__(chat_id, user_id):
     log_channel = sql.get_chat_log_channel(chat_id)
     if log_channel:
         log_channel_info = dispatcher.bot.get_chat(log_channel)
         return f"This group has all it's logs sent to: {escape_markdown(log_channel_info.title)} (`{log_channel}`)"
     return "No log channel is set for this group!"
コード例 #8
0
 def __chat_settings__(chat_id, user_id):
     log_channel = sql.get_chat_log_channel(chat_id)
     if log_channel:
         log_channel_info = dispatcher.bot.get_chat(log_channel)
         return f"Bu grupta günlüklerinin tümü var: {escape_markdown(log_channel_info.title)} (`{log_channel}`)"
     return "Bu grup için günlük kanalı ayarlanmadı!"