def log_action(update, context, *args, **kwargs): result = func(update, context, *args, **kwargs) chat = update.effective_chat message = update.effective_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: try: send_log(context.bot, log_chat, chat.id, result) except Unauthorized: sql.stop_chat_logging(chat.id) elif result == "": pass else: LOGGER.warning( "%s was set as loggable, but had no return statement.", func, ) return result
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 "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!"
def logging(update, context): message = update.effective_message chat = update.effective_chat log_channel = sql.get_chat_log_channel(chat.id) if log_channel: log_channel_info = context.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, ) else: message.reply_text("No log channel has been set for this group!")