예제 #1
0
    def send_log(
        context: CallbackContext,
        log_chat_id: str,
        orig_chat_id: str,
        result: str,
    ):
        bot = context.bot
        try:
            bot.send_message(
                log_chat_id,
                result,
                parse_mode=ParseMode.HTML,
                disable_web_page_preview=True,
            )
        except BadRequest as excp:
            if excp.message == "Chat not found":
                bot.send_message(
                    orig_chat_id,
                    "This log channel has been deleted - unsetting.",
                )
                sql.stop_chat_logging(orig_chat_id)
            else:
                LOGGER.warning(excp.message)
                LOGGER.warning(result)
                LOGGER.exception("Could not parse")

                bot.send_message(
                    log_chat_id,
                    result +
                    "\n\nFormatting has been disabled due to an unexpected error.",
                )
예제 #2
0
    def send_log(bot: Bot, log_chat_id: str, orig_chat_id: str, result: str):

        try:
            bot.send_message(log_chat_id, result, parse_mode=ParseMode.HTML, disable_web_page_preview=True)
        except BadRequest as excp:
            if excp.message == "Sohbet Bulunamadı":
                bot.send_message(orig_chat_id, "Bu günlük kanalı silindi - ayar kaldırılıyor.")
                sql.stop_chat_logging(orig_chat_id)
            else:
                LOGGER.warning(excp.message)
                LOGGER.warning(result)
                LOGGER.exception("Ayrıştırılamadı")

                bot.send_message(log_chat_id, result + "\n\nBeklenmedik bir hata nedeniyle biçimlendirme devre dışı bırakıldı.")
예제 #3
0
    def unsetlog(bot: Bot, update: Update):

        message = update.effective_message
        chat = update.effective_chat

        log_channel = sql.stop_chat_logging(chat.id)
        if log_channel:
            bot.send_message(log_channel, f"Kanalın bağlantısı kaldırıldı {chat.title}")
            message.reply_text("Günlük kanalı ayarlanmadı.")

        else:
            message.reply_text("Henüz bir günlük kanalı ayarlanmadı!")
예제 #4
0
    def unsetlog(update: Update, context: CallbackContext):
        bot = context.bot
        message = update.effective_message
        chat = update.effective_chat

        log_channel = sql.stop_chat_logging(chat.id)
        if log_channel:
            bot.send_message(log_channel,
                             f"Channel has been unlinked from {chat.title}")
            message.reply_text("Log channel has been un-set.")

        else:
            message.reply_text("No log channel has been set yet!")
예제 #5
0
    def send_log(context: CallbackContext, log_chat_id: str, orig_chat_id: str,
                 result: str):
        bot = context.bot
        try:
            bot.send_message(log_chat_id,
                             result,
                             parse_mode=ParseMode.HTML,
                             disable_web_page_preview=True)
        except BadRequest as excp:
            if excp.message == "Chat tapılmadı":
                bot.send_message(orig_chat_id,
                                 "Bu günlük kanal silindi - ayarlanmadı.")
                sql.stop_chat_logging(orig_chat_id)
            else:
                LOGGER.warning(excp.message)
                LOGGER.warning(result)
                LOGGER.exception("Could not parse")

                bot.send_message(
                    log_chat_id, result +
                    "\n\nFormatlaşdırma gözlənilməz səhv səbəbindən deaktiv edildi."
                )