def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] conn = connected(bot, update, chat, user.id) if not conn == False: chatD = dispatcher.bot.getChat(conn) else: if chat.type == "private": exit(1) else: chatD = update.effective_chat if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chatD.id, enable_cmd): update.effective_message.reply_text( tld(chat.id, "Enabled the use of `{}` in *{}*").format( enable_cmd, chatD.title), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text( tld(chat.id, "Is that even disabled?")) else: update.effective_message.reply_text( tld(chat.id, "What should I enable?"))
def enable(update: Update, context: CallbackContext): args = context.args chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text( get_string( "disable", "ENABLED_COMMAND", lang.get_lang( update.effective_chat.id)).format(enable_cmd), parse_mode=ParseMode.MARKDOWN) # ENABLED_COMMAND else: update.effective_message.reply_text( get_string( "disable", "ERR_NOT_DISABLED", lang.get_lang( update.effective_chat.id))) # ERR_NOT_DISABLED else: update.effective_message.reply_text( get_string( "disable", "ERR_NO_COMMAND_TO_ENABLE", lang.get_lang( update.effective_chat.id))) # ERR_NO_COMMAND_TO_ENABLE
def enable_module(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat if len(args) >= 1: enable_module = "tg_bot.modules." + args[0].rsplit(".", 1)[0] try: module = importlib.import_module(enable_module) except: update.effective_message.reply_text( "Does that module even exist?") return try: command_list = module.__command_list__ except: update.effective_message.reply_text( "Module does not contain command list!") return enabled_cmds = [] failed_enabled_cmds = [] for enable_cmd in command_list: if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): enabled_cmds.append(enable_cmd) else: failed_enabled_cmds.append(enable_cmd) if enabled_cmds: enabled_cmds_string = ", ".join(enabled_cmds) update.effective_message.reply_text( "Enabled the uses of `{}`".format(enabled_cmds_string), parse_mode=ParseMode.MARKDOWN) if failed_enabled_cmds: failed_enabled_cmds_string = ", ".join(failed_enabled_cmds) update.effective_message.reply_text( "Are the commands `{}` even disabled?".format( failed_enabled_cmds_string), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text("What should I enable?")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith("/"): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text("`{}` Kullanımı etkinleştirildi".format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text("Bu bile engelli?") else: update.effective_message.reply_text("Neyi aktif etmeliyim?")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text("Enabled the use of `{}`".format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text("Is that even disabled?") else: update.effective_message.reply_text("What should I enable?")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text("`{}` ന്റെ ഉപയോഗം enable ചെയ്തിട്ടുണ്ട്!".format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text("അത് disabled അല്ലല്ലോ?") else: update.effective_message.reply_text("എന്താണ് enable ചെയ്യേണ്ടത് എന്നു പറഞ്ഞില്ലല്ലോ?")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text("`{}` əmrinin istifadəsi aktiv edildi".format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text("Bu heç deaktiv olmuşduki??") else: update.effective_message.reply_text("Aktiv ediləcək əmri vermədinsə nəyi aktiv edə bilərəmki?")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text("استفاده از دستور `{}` فعال شد".format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text("مگه اون غیر فعاله؟") else: update.effective_message.reply_text("چیو باید فعال کنم؟")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text("مكن استخدام `{}`".format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text("هل هذا حتى المعطلين؟") else: update.effective_message.reply_text("ماذا يجب أن تمكن؟")
def enable_module(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat if len(args) >= 1: enable_module = "tg_bot.modules." + args[0].rsplit(".", 1)[0] try: module = importlib.import_module(enable_module) except: update.effective_message.reply_text("Apakah modul itu ada?") return try: command_list = module.__command_list__ except: update.effective_message.reply_text( "Modul tidak berisi daftar perintah!") return enabled_cmds = [] failed_enabled_cmds = [] for enable_cmd in command_list: if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): enabled_cmds.append(enable_cmd) else: failed_enabled_cmds.append(enable_cmd) if enabled_cmds: enabled_cmds_string = ", ".join(enabled_cmds) update.effective_message.reply_text( f"Mengaktifkan penggunaan `{enabled_cmds_string}`", parse_mode=ParseMode.MARKDOWN, ) if failed_enabled_cmds: failed_enabled_cmds_string = ", ".join(failed_enabled_cmds) update.effective_message.reply_text( f"Apakah perintahnya `{failed_enabled_cmds_string}` bahkan cacat?", parse_mode=ParseMode.MARKDOWN, ) else: update.effective_message.reply_text( "Apa yang harus saya aktifkan?")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text( " `{}`के उपयोग को सक्षम किया".format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text("क्या वह भी डिसएबल है?") else: update.effective_message.reply_text("मुझे क्या इनेबल करना चाहिए?")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text( "භාවිතය සක්රීය කර ඇත `{}`".format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text("එය පවා ආබාධිතද?") else: update.effective_message.reply_text("මා සක්රීය කළ යුත්තේ කුමක්ද?")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text( "`{}` 명령어의 사용을 활성화합니다.".format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text("이미 활성화되어 있어요.") else: update.effective_message.reply_text("활성화할 명령어를 입력해 주세요.")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text( "`{}` kullanımı etkinlestirildi".format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text("Bu devre dışı mı kalsın?") else: update.effective_message.reply_text("Neyi etkinleştirelim??")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text( "Abilito l'uso del comando `{}`".format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text( "Sei sicuro che questo comando fosse disabilitato?") else: update.effective_message.reply_text("Cosa dovrei abilitare?")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text( "Włączone użycie `{}`".format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text( "Czy to jest wogóle wyłączone?") else: update.effective_message.reply_text("Co mam włączyć?")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text( "Enabled the use of `{}`".format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text( "അതിനാരാ അത് disable ആക്കിയെ?") else: update.effective_message.reply_text( "ഞാൻ എന്താണ് enable അക്കേണ്ടത്?")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text( "Is command ko Enable kiya gaya `{}`".format(enable_cmd), parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text( "Is command ko disable nhi kiya gaya tha @king_un_007 se contact kare for more info " ) else: update.effective_message.reply_text("Kya enable karna h?")
def enable(update, context): chat = update.effective_chat # type: Optional[Chat] user = update.effective_user args = context.args conn = connected(context.bot, update, chat, user.id, need_admin=True) if conn: chat = dispatcher.bot.getChat(conn) chat_id = conn chat_name = dispatcher.bot.getChat(conn).title else: if update.effective_message.chat.type == "private": send_message( update.effective_message, "This command is meant to be used in group not in PM", ) return "" chat = update.effective_chat chat_id = update.effective_chat.id chat_name = update.effective_message.chat.title if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): if conn: text = "Enabled the use of `{}` command in *{}*!".format( enable_cmd, chat_name) else: text = "Enabled the use of `{}` command!".format( enable_cmd) send_message( update.effective_message, text, parse_mode=ParseMode.MARKDOWN, ) else: send_message(update.effective_message, "Is that even disabled?") else: send_message(update.effective_message, "What should I enable?")
def enable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text( f"Enabled the use of `{enable_cmd}`", parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text( "Apakah itu bahkan dinonaktifkan?") else: update.effective_message.reply_text( "Apa yang harus saya aktifkan?")
def enable(update, context): chat = update.effective_chat # type: Optional[Chat] args = context.args if len(args) >= 1: enable_cmd = args[0] if enable_cmd.startswith(CMD_STARTERS): enable_cmd = enable_cmd[1:] if sql.enable_command(chat.id, enable_cmd): update.effective_message.reply_text(tld( chat.id, "Enabled the use of `{}`").format(enable_cmd), parse_mode='markdown') else: update.effective_message.reply_text( tld(chat.id, "Is that even disabled?")) else: update.effective_message.reply_text( tld(chat.id, "What should I enable?"))