def fed_notif(bot: Bot, update: Update, args: List[str]): spam = spamfilters(update.effective_message.text, update.effective_message.from_user.id, update.effective_chat.id) if spam == True: return update.effective_message.reply_text("Spammer detected! Ignoring user.") chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] msg = update.effective_message # type: Optional[Message] fed_id = sql.get_fed_id(chat.id) if not fed_id: update.effective_message.reply_text("This group is not a part of any federation!") return if args: if args[0] in ("yes", "on"): sql.set_feds_setting(user.id, True) msg.reply_text("Reporting Federation back up! Every user who is fban / unfban you will be notified via PM.") elif args[0] in ("no", "off"): sql.set_feds_setting(user.id, False) msg.reply_text("Reporting Federation has stopped! Every user who is fban / unfban you will not be notified via PM.") else: msg.reply_text("Please enter `on`/`off`", parse_mode="markdown") else: getreport = sql.user_feds_report(user.id) msg.reply_text("Your current Federation report preferences: `{}`".format(getreport), parse_mode="markdown")
def fed_notif(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] msg = update.effective_message # type: Optional[Message] fed_id = sql.get_fed_id(chat.id) if not fed_id: update.effective_message.reply_text("This group is not a part of any federation!") return if args: if args[0] in ("yes", "on"): sql.set_feds_setting(user.id, True) msg.reply_text("Reporting turned on! Users fbanned/un-fbanned by you will be notified via PM.") elif args[0] in ("no", "off"): sql.set_feds_setting(user.id, False) msg.reply_text("Reporting turned off! Users fbanned/un-fbanned will not be notified via PM.") else: msg.reply_text("Please enter `on`/`off`", parse_mode="markdown") else: getreport = sql.user_feds_report(user.id) msg.reply_text("Your current Federation report preferences: `{}`".format(getreport), parse_mode="markdown")