Exemplo n.º 1
0
 def log_action(bot: Bot, update: Update, *args, **kwargs):
     try:
         result = func(bot, update, *args, **kwargs)
     except Exception:
         return
     chat = update.effective_chat  # type: Optional[Chat]
     message = update.effective_message  # type: Optional[Message]
     if result:
         if chat.type == chat.SUPERGROUP and chat.username:
             result += tld(chat.id, "log_channel_link").format(
                 chat.username, message.message_id)
         if log_chat := sql.get_chat_log_channel(chat.id):
             send_log(bot, log_chat, chat.id, result)
Exemplo n.º 2
0
def logging(bot: Bot, update: Update):
    message = update.effective_message  # type: Optional[Message]
    chat = update.effective_chat  # type: Optional[Chat]

    if log_channel := sql.get_chat_log_channel(chat.id):
        try:
            log_channel_info = bot.get_chat(log_channel)
            message.reply_text(tld(chat.id,
                                   "log_channel_grp_curr_conf").format(
                                       escape_markdown(log_channel_info.title),
                                       log_channel),
                               parse_mode=ParseMode.MARKDOWN)
        except Exception:
            print("Nut")
Exemplo n.º 3
0
 def __chat_settings__(bot, update, chat, chatP, user):
     log_channel = sql.get_chat_log_channel(chat.id)
     if log_channel:
         log_channel_info = dispatcher.bot.get_chat(log_channel)
         return "This group has all it's logs sent to: {} (`{}`)".format(
             escape_markdown(log_channel_info.title), log_channel)
     return "No log channel is set for this group!"
Exemplo n.º 4
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 tl(
             user_id,
             "Grup ini memiliki semua log yang dikirim ke: {} (`{}`)"
         ).format(escape_markdown(log_channel_info.title), log_channel)
     return tl(user_id,
               "Tidak ada saluran masuk yang ditetapkan untuk grup ini!")
Exemplo n.º 5
0
    def logging(bot: Bot, update: Update):
        message = update.effective_message  # type: Optional[Message]
        chat = update.effective_chat  # type: Optional[Chat]

        log_channel = sql.get_chat_log_channel(chat.id)
        if log_channel:
            try:
                log_channel_info = bot.get_chat(log_channel)
                message.reply_text(
                    "This group has all it's logs sent to: {} (`{}`)".format(
                        escape_markdown(log_channel_info.title), log_channel),
                    parse_mode=ParseMode.MARKDOWN)
            except:
                print("Nut")
        else:
            message.reply_text("No log channel has been set for this group!")
Exemplo n.º 6
0
    def logging(update, context):
        chat = update.effective_chat  # type: Optional[Chat]

        log_channel = sql.get_chat_log_channel(chat.id)
        if log_channel:
            log_channel_info = context.bot.get_chat(log_channel)
            send_message(
                update.effective_message,
                tl(update.effective_message,
                   "These group have all logs sent to: {} (`{}`)").format(
                       escape_markdown(log_channel_info.title), log_channel),
                parse_mode=ParseMode.MARKDOWN)

        else:
            send_message(
                update.effective_message,
                tl(
                    update.effective_message,
                    "Tidak ada saluran log yang telah ditetapkan untuk grup ini!"
                ))
Exemplo n.º 7
0
        def log_action(bot: Bot, update: Update, *args, **kwargs):
            result = func(bot, update, *args, **kwargs)
            chat = update.effective_chat  # type: Optional[Chat]
            message = update.effective_message  # type: Optional[Message]
            if result:
                if chat.type == chat.SUPERGROUP and chat.username:
                    result += "\n<b>Link:</b> " \
                              "<a href=\"http://telegram.me/{}/{}\">click here</a>".format(chat.username,
                                                                                           message.message_id)
                log_chat = sql.get_chat_log_channel(chat.id)
                if log_chat:
                    send_log(bot, log_chat, chat.id, result)
            elif result == "":
                pass
            else:
                LOGGER.warning(
                    "%s was set as loggable, but had no return statement.",
                    func)

            return result
Exemplo n.º 8
0
    def log_action(bot: Bot, update: Update, *args, **kwargs):
        try:
            result = func(bot, update, *args, **kwargs)
        except Exception:
            return
        chat = update.effective_chat  # type: Optional[Chat]
        message = update.effective_message  # type: Optional[Message]
        if result:
            if chat.type == chat.SUPERGROUP and chat.username:
                result += tld(chat.id, "log_channel_link").format(
                    chat.username, message.message_id)
            log_chat = sql.get_chat_log_channel(chat.id)
            if log_chat:
                send_log(bot, log_chat, chat.id, result)
        elif result == "":
            pass
        else:
            LOGGER.warning(
                "%s was set as loggable, but had no return statement.", func)

        return result