def welcome(update: Update, context: CallbackContext): args = context.args chat = update.effective_chat # if no args, show current replies. if not args or args[0].lower() == "noformat": noformat = True pref, welcome_m, cust_content, welcome_type = sql.get_welc_pref( chat.id) update.effective_message.reply_text( f"Bu qrupun qarşılama ayarı `{pref}`.\n" f"*Qarşılama mesajı:*", parse_mode=ParseMode.MARKDOWN, ) if welcome_type == sql.Types.BUTTON_TEXT or welcome_type == sql.Types.TEXT: buttons = sql.get_welc_buttons(chat.id) if noformat: welcome_m += revert_buttons(buttons) update.effective_message.reply_text(welcome_m) else: keyb = build_keyboard(buttons) keyboard = InlineKeyboardMarkup(keyb) send(update, welcome_m, keyboard, sql.DEFAULT_WELCOME) else: buttons = sql.get_welc_buttons(chat.id) if noformat: welcome_m += revert_buttons(buttons) ENUM_FUNC_MAP[welcome_type](chat.id, cust_content, caption=welcome_m) else: keyb = build_keyboard(buttons) keyboard = InlineKeyboardMarkup(keyb) ENUM_FUNC_MAP[welcome_type]( chat.id, cust_content, caption=welcome_m, reply_markup=keyboard, parse_mode=ParseMode.MARKDOWN, disable_web_page_preview=True, ) elif len(args) >= 1: if args[0].lower() in ("on", "yes"): sql.set_welc_preference(str(chat.id), True) update.effective_message.reply_text( "Tamam, artıq qrupa gələn üzvləri salamlayacam.") elif args[0].lower() in ("off", "no"): sql.set_welc_preference(str(chat.id), False) update.effective_message.reply_text( "Artıq gələnləri qarşılamayacam.") else: update.effective_message.reply_text( "Yalnız 'on/yes' və 'off/no' əmrlərini başa düşürəm!")
def welcome(update: Update, context: CallbackContext): args = context.args chat = update.effective_chat # if no args, show current replies. if not args or args[0].lower() == "noformat": noformat = True pref, welcome_m, cust_content, welcome_type = sql.get_welc_pref( chat.id) update.effective_message.reply_text( f"This chat has it's welcome setting set to: `{pref}`.\n" f"*The welcome message (not filling the {{}}) is:*", parse_mode=ParseMode.MARKDOWN, ) if welcome_type == sql.Types.BUTTON_TEXT or welcome_type == sql.Types.TEXT: buttons = sql.get_welc_buttons(chat.id) if noformat: welcome_m += revert_buttons(buttons) update.effective_message.reply_text(welcome_m) else: keyb = build_keyboard(buttons) keyboard = InlineKeyboardMarkup(keyb) send(update, welcome_m, keyboard, sql.DEFAULT_WELCOME) else: buttons = sql.get_welc_buttons(chat.id) if noformat: welcome_m += revert_buttons(buttons) ENUM_FUNC_MAP[welcome_type](chat.id, cust_content, caption=welcome_m) else: keyb = build_keyboard(buttons) keyboard = InlineKeyboardMarkup(keyb) ENUM_FUNC_MAP[welcome_type]( chat.id, cust_content, caption=welcome_m, reply_markup=keyboard, parse_mode=ParseMode.MARKDOWN, disable_web_page_preview=True, ) elif len(args) >= 1: if args[0].lower() in ("on", "yes"): sql.set_welc_preference(str(chat.id), True) update.effective_message.reply_text( "Okay! I'll greet members when they join.") elif args[0].lower() in ("off", "no"): sql.set_welc_preference(str(chat.id), False) update.effective_message.reply_text( "I'll go loaf around and not welcome anyone then.") else: update.effective_message.reply_text( "I understand 'on/yes' or 'off/no' only!")
def welcome(update: Update, context: CallbackContext): args = context.args chat = update.effective_chat # if no args, show current replies. if not args or args[0].lower() == "noformat": noformat = True pref, welcome_m, cust_content, welcome_type = sql.get_welc_pref( chat.id) update.effective_message.reply_text( f"Bu sohbetin hoş geldiniz ayarı şu şekilde ayarlanmıştır: `{pref}`.\n" f"*Hoş geldiniz mesajı ({{}} doldurulmadan) :*", parse_mode=ParseMode.MARKDOWN, ) if welcome_type == sql.Types.BUTTON_TEXT or welcome_type == sql.Types.TEXT: buttons = sql.get_welc_buttons(chat.id) if noformat: welcome_m += revert_buttons(buttons) update.effective_message.reply_text(welcome_m) else: keyb = build_keyboard(buttons) keyboard = InlineKeyboardMarkup(keyb) send(update, welcome_m, keyboard, sql.DEFAULT_WELCOME) else: buttons = sql.get_welc_buttons(chat.id) if noformat: welcome_m += revert_buttons(buttons) ENUM_FUNC_MAP[welcome_type](chat.id, cust_content, caption=welcome_m) else: keyb = build_keyboard(buttons) keyboard = InlineKeyboardMarkup(keyb) ENUM_FUNC_MAP[welcome_type]( chat.id, cust_content, caption=welcome_m, reply_markup=keyboard, parse_mode=ParseMode.MARKDOWN, disable_web_page_preview=True, ) elif len(args) >= 1: if args[0].lower() in ("on", "yes"): sql.set_welc_preference(str(chat.id), True) update.effective_message.reply_text( "Tamam! Katıldıklarında üyeleri selamlayacağım.") elif args[0].lower() in ("off", "no"): sql.set_welc_preference(str(chat.id), False) update.effective_message.reply_text( "Etrafta dolanacağım ve o zaman kimseyi hoş karşılamayacağım.") else: update.effective_message.reply_text( "Sadece 'on/yes' or 'off/no' Anlıyorum!")
def welcome(update: Update, context: CallbackContext): args = context.args chat = update.effective_chat # if no args, show current replies. if not args or args[0].lower() == "noformat": noformat = True pref, welcome_m, cust_content, welcome_type = sql.get_welc_pref(chat.id) update.effective_message.reply_text( f"Este chat tiene su configuración de bienvenida establecida en: `{pref}`.\n" f"*El mensaje de bienvenida (que no llena el {{}}) es:*", parse_mode=ParseMode.MARKDOWN, ) if welcome_type == sql.Types.BUTTON_TEXT or welcome_type == sql.Types.TEXT: buttons = sql.get_welc_buttons(chat.id) if noformat: welcome_m += revert_buttons(buttons) update.effective_message.reply_text(welcome_m) else: keyb = build_keyboard(buttons) keyboard = InlineKeyboardMarkup(keyb) send(update, welcome_m, keyboard, sql.DEFAULT_WELCOME) else: buttons = sql.get_welc_buttons(chat.id) if noformat: welcome_m += revert_buttons(buttons) ENUM_FUNC_MAP[welcome_type]( chat.id, cust_content, caption=welcome_m) else: keyb = build_keyboard(buttons) keyboard = InlineKeyboardMarkup(keyb) ENUM_FUNC_MAP[welcome_type]( chat.id, cust_content, caption=welcome_m, reply_markup=keyboard, parse_mode=ParseMode.MARKDOWN, disable_web_page_preview=True, ) elif len(args) >= 1: if args[0].lower() in ("on", "yes"): sql.set_welc_preference(str(chat.id), True) update.effective_message.reply_text( "¡Okey! Saludaré a los miembros cuando se unan.") elif args[0].lower() in ("off", "no"): sql.set_welc_preference(str(chat.id), False) update.effective_message.reply_text( "Voy a holgazanear y no recibiré a nadie entonces c:") else: update.effective_message.reply_text( "¡Sólo entiendo 'on/yes' o 'off/no'!")
def welcome(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # if no args, show current replies. if not args or args[0].lower() == "noformat": noformat = True pref, welcome_m, welcome_type = sql.get_welc_pref(chat.id) update.effective_message.reply_text( f"Bu sohbette hoş geldiniz ayarı var: `{pref}`.\n" f"*Karşılama mesajı (doldurmamak {{}}) is:*", parse_mode=ParseMode.MARKDOWN) if welcome_type == sql.Types.BUTTON_TEXT: buttons = sql.get_welc_buttons(chat.id) if noformat: welcome_m += revert_buttons(buttons) update.effective_message.reply_text(welcome_m) else: keyb = build_keyboard(buttons) keyboard = InlineKeyboardMarkup(keyb) send(update, welcome_m, keyboard, sql.DEFAULT_WELCOME) else: if noformat: ENUM_FUNC_MAP[welcome_type](chat.id, welcome_m) else: ENUM_FUNC_MAP[welcome_type](chat.id, welcome_m, parse_mode=ParseMode.MARKDOWN) elif len(args) >= 1: if args[0].lower() in ("on", "yes"): sql.set_welc_preference(str(chat.id), True) update.effective_message.reply_text( "Tamam! Üyeleri katıldıklarında selamlayacağım.") elif args[0].lower() in ("off", "no"): sql.set_welc_preference(str(chat.id), False) update.effective_message.reply_text( "Etrafta ekmek yapacağım ve o zaman kimseye hoş gelmeyeceğim.") else: update.effective_message.reply_text( "anlıyorum 'on/yes' or 'off/no' sadece!")