def disable_module(update: Update, context: CallbackContext): args = context.args chat = update.effective_chat if len(args) >= 1: disable_module = "SaitamaRobot.modules." + args[0].rsplit(".", 1)[0] try: module = importlib.import_module(disable_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 disabled_cmds = [] failed_disabled_cmds = [] for disable_cmd in command_list: if disable_cmd.startswith(CMD_STARTERS): disable_cmd = disable_cmd[1:] if disable_cmd in set(DISABLE_CMDS + DISABLE_OTHER): sql.disable_command(chat.id, str(disable_cmd).lower()) disabled_cmds.append(disable_cmd) else: failed_disabled_cmds.append(disable_cmd) if disabled_cmds: disabled_cmds_string = ", ".join(disabled_cmds) update.effective_message.reply_text( f"Disabled the uses of `{disabled_cmds_string}`", parse_mode=ParseMode.MARKDOWN, ) if failed_disabled_cmds: failed_disabled_cmds_string = ", ".join(failed_disabled_cmds) update.effective_message.reply_text( f"Commands `{failed_disabled_cmds_string}` can't be disabled", parse_mode=ParseMode.MARKDOWN, ) else: update.effective_message.reply_text("What should I disable?")
def disable_module(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat if len(args) >= 1: disable_module = "SaitamaRobot.modules." + args[0].rsplit(".", 1)[0] try: module = importlib.import_module(disable_module) except: update.effective_message.reply_text("Bu modül var mı?") return try: command_list = module.__command_list__ except: update.effective_message.reply_text( "Modül komut listesi içermiyor!") return disabled_cmds = [] failed_disabled_cmds = [] for disable_cmd in command_list: if disable_cmd.startswith(CMD_STARTERS): disable_cmd = disable_cmd[1:] if disable_cmd in set(DISABLE_CMDS + DISABLE_OTHER): sql.disable_command(chat.id, str(disable_cmd).lower()) disabled_cmds.append(disable_cmd) else: failed_disabled_cmds.append(disable_cmd) if disabled_cmds: disabled_cmds_string = ", ".join(disabled_cmds) update.effective_message.reply_text( f"Kullanımını devre dışı bıraktı `{disabled_cmds_string}`", parse_mode=ParseMode.MARKDOWN) if failed_disabled_cmds: failed_disabled_cmds_string = ", ".join(failed_disabled_cmds) update.effective_message.reply_text( f"Commands `{failed_disabled_cmds_string}`devre dışı bırakılamaz", parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text( "Neyi devre dışı bırakmalıyım??")
def disable_module(update: Update, context: CallbackContext): args = context.args chat = update.effective_chat if len(args) >= 1: disable_module = "SaitamaRobot.modules." + args[0].rsplit(".", 1)[0] try: module = importlib.import_module(disable_module) except: update.effective_message.reply_text("Belə bir əmr mövcud idi?") return try: command_list = module.__command_list__ except: update.effective_message.reply_text( "Modul içində command list yoxdur!") return disabled_cmds = [] failed_disabled_cmds = [] for disable_cmd in command_list: if disable_cmd.startswith(CMD_STARTERS): disable_cmd = disable_cmd[1:] if disable_cmd in set(DISABLE_CMDS + DISABLE_OTHER): sql.disable_command(chat.id, str(disable_cmd).lower()) disabled_cmds.append(disable_cmd) else: failed_disabled_cmds.append(disable_cmd) if disabled_cmds: disabled_cmds_string = ", ".join(disabled_cmds) update.effective_message.reply_text( f"`{disabled_cmds_string}` istifadəsi deaktiv edildi", parse_mode=ParseMode.MARKDOWN) if failed_disabled_cmds: failed_disabled_cmds_string = ", ".join(failed_disabled_cmds) update.effective_message.reply_text( f"`{failed_disabled_cmds_string}` deaktiv edilə bilməz", parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text("Nəyi deaktiv etməliyəmki?")
def disable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat if len(args) >= 1: disable_cmd = args[0] if disable_cmd.startswith(CMD_STARTERS): disable_cmd = disable_cmd[1:] if disable_cmd in set(DISABLE_CMDS + DISABLE_OTHER): sql.disable_command(chat.id, str(disable_cmd).lower()) update.effective_message.reply_text( f"Disabled the use of `{disable_cmd}`", parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text( "That command can't be disabled") else: update.effective_message.reply_text("What should I disable?")
def disable(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat if len(args) >= 1: disable_cmd = args[0] if disable_cmd.startswith(CMD_STARTERS): disable_cmd = disable_cmd[1:] if disable_cmd in set(DISABLE_CMDS + DISABLE_OTHER): sql.disable_command(chat.id, str(disable_cmd).lower()) update.effective_message.reply_text( f"Kullanımını devre dışı bıraktı `{disable_cmd}`", parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text( "Bu komut devre dışı bırakılamaz") else: update.effective_message.reply_text( "Neyi devre dışı bırakmalıyım?")
def disable(update: Update, context: CallbackContext): args = context.args chat = update.effective_chat if len(args) >= 1: disable_cmd = args[0] if disable_cmd.startswith(CMD_STARTERS): disable_cmd = disable_cmd[1:] if disable_cmd in set(DISABLE_CMDS + DISABLE_OTHER): sql.disable_command(chat.id, str(disable_cmd).lower()) update.effective_message.reply_text( f"`{disable_cmd}` istifadəsi deaktiv edildi", parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text( "Bu əmr deaktiv edilə bilməz") else: update.effective_message.reply_text("Nəyi deaktiv etməliyəmki?")
def disable(update: Update, context: CallbackContext): args = context.args chat = update.effective_chat if len(args) >= 1: disable_cmd = args[0] if disable_cmd.startswith(PREFIX): disable_cmd = disable_cmd[1:] if disable_cmd in set(DISABLE_CMDS + DISABLE_OTHER): sql.disable_command(chat.id, str(disable_cmd).lower()) update.effective_message.reply_text( f"Disabled the use of `{disable_cmd}`", parse_mode=ParseMode.MARKDOWN, ) else: update.effective_message.reply_text( "That command can't be disabled") else: update.effective_message.reply_text("What should I disable?")