def report_setting(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] msg = update.effective_message # type: Optional[Message] if chat.type == chat.PRIVATE: if len(args) >= 1: if args[0] in ("yes", "on"): sql.set_user_setting(chat.id, True) msg.reply_text(tld(chat.id, "reports_pm_on")) elif args[0] in ("no", "off"): sql.set_user_setting(chat.id, False) msg.reply_text(tld(chat.id, "reports_pm_off")) else: msg.reply_text(tld(chat.id, "reports_pm_pref").format( sql.user_should_report(chat.id)), parse_mode=ParseMode.MARKDOWN) else: if len(args) >= 1: if args[0] in ("yes", "on"): sql.set_chat_setting(chat.id, True) msg.reply_text(tld(chat.id, "reports_chat_on")) elif args[0] in ("no", "off"): sql.set_chat_setting(chat.id, False) msg.reply_text(tld(chat.id, "reports_chat_off")) else: msg.reply_text(tld(chat.id, "reports_chat_pref").format( sql.chat_should_report(chat.id)), parse_mode=ParseMode.MARKDOWN)
def report_setting(update, context): chat = update.effective_chat args = context.args if chat.type == chat.PRIVATE: if len(args) >= 1: if args[0] in ("yes", "on"): sql.set_user_setting(chat.id, True) send_message(update.effective_message, tl(update.effective_message, "Menghidupkan pelaporan! Anda akan diberi tahu setiap kali ada yang melaporkan sesuatu.")) elif args[0] in ("no", "off"): sql.set_user_setting(chat.id, False) send_message(update.effective_message, tl(update.effective_message, "Mematikan pelaporan! Anda tidak akan mendapatkan laporan apa pun.")) else: send_message(update.effective_message, tl(update.effective_message, "Preferensi laporan Anda saat ini: `{}`").format(sql.user_should_report(chat.id)), parse_mode=ParseMode.MARKDOWN) else: if len(args) >= 1: if args[0] in ("yes", "on"): sql.set_chat_setting(chat.id, True) send_message(update.effective_message, tl(update.effective_message, "Menghidupkan pelaporan! Admin yang telah mengaktifkan laporan akan diberi tahu ketika seseorang menyebut /report " "atau @admin.")) elif args[0] in ("no", "off"): sql.set_chat_setting(chat.id, False) send_message(update.effective_message, tl(update.effective_message, "Mematikan pelaporan! Tidak ada admin yang akan diberitahukan ketika seseorang menyebut /report atau @admin.")) else: send_message(update.effective_message, tl(update.effective_message, "Pengaturan obrolan saat ini adalah: `{}`").format(sql.chat_should_report(chat.id)), parse_mode=ParseMode.MARKDOWN)
def report_setting(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] msg = update.effective_message # type: Optional[Message] if chat.type == chat.PRIVATE: if len(args) >= 1: if args[0] in ("yes", "on"): sql.set_user_setting(chat.id, True) msg.reply_text( "Turned on reporting! You'll be notified whenever anyone reports something." ) elif args[0] in ("no", "off"): sql.set_user_setting(chat.id, False) msg.reply_text( "Turned off reporting! You wont get any reports.") else: msg.reply_text("Your current report preference is: `{}`".format( sql.user_should_report(chat.id)), parse_mode=ParseMode.MARKDOWN) else: if len(args) >= 1: if args[0] in ("yes", "on"): sql.set_chat_setting(chat.id, True) msg.reply_text( "Turned on reporting! Admins who have turned on reports will be notified when /report " "or @admin are called.") elif args[0] in ("no", "off"): sql.set_chat_setting(chat.id, False) msg.reply_text( "Turned off reporting! No admins will be notified on /report or @admin." ) else: msg.reply_text("This chat's current setting is: `{}`".format( sql.chat_should_report(chat.id)), parse_mode=ParseMode.MARKDOWN)
def control_panel_user(bot, update): user = update.effective_user # type: Optional[User] chat = update.effective_chat query = update.callback_query enable = re.match(r"panel_reporting_U_enable", query.data) disable = re.match(r"panel_reporting_U_disable", query.data) query.message.delete() if enable: sql.set_user_setting(chat.id, True) text = "Enabled reporting in your pm!" else: sql.set_user_setting(chat.id, False) text = "Disabled reporting in your pm!" keyboard = [[ InlineKeyboardButton(text="⬅️ Back", callback_data="cntrl_panel_U(1)") ]] update.effective_message.reply_text( text, reply_markup=InlineKeyboardMarkup(keyboard), parse_mode=ParseMode.MARKDOWN)