def reset_goodbye(bot: Bot, update: Update) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] sql.set_custom_gdbye(chat.id, None, sql.DEFAULT_GOODBYE, sql.Types.TEXT) update.effective_message.reply_text( tld(chat.id, 'welcome_reset_goodbye_success')) return "<b>{}:</b>" \ "\n#RESET_GOODBYE" \ "\n<b>Admin:</b> {}" \ "\nReset the goodbye message.".format(escape(chat.title), mention_html(user.id, user.first_name))
def set_goodbye(bot: Bot, update: Update) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] msg = update.effective_message # type: Optional[Message] text, data_type, content, buttons = get_welcome_type(msg) # If user is not set text and not reply a message if not msg.reply_to_message: if len(msg.text.split()) == 1: msg.reply_text(tld(chat.id, 'welcome_set_welcome_no_text'), parse_mode="markdown") return "" if data_type is None: msg.reply_text(tld(chat.id, 'welcome_set_welcome_no_datatype')) return "" sql.set_custom_gdbye(chat.id, content, text, data_type, buttons) msg.reply_text(tld(chat.id, 'welcome_set_goodbye_success')) return "<b>{}:</b>" \ "\n#SET_GOODBYE" \ "\n<b>Admin:</b> {}" \ "\nSet the goodbye message.".format(escape(chat.title), mention_html(user.id, user.first_name))