コード例 #1
0
ファイル: disable.py プロジェクト: toxic-dev0/LyndaRobot
 def check_update(self, update):
     chat = update.effective_chat
     if super().check_update(update):
         if sql.is_command_disabled(chat.id, self.friendly):
             return False
         else:
             return True
コード例 #2
0
ファイル: disable.py プロジェクト: sandidias/Chizuru
        def check_update(self, update):

            chat = update.effective_chat
            message = update.effective_message
            filter_result = self.filters(update)

            try:
                args = message.text.split()[1:]
            except:
                args = []

            if super().check_update(update):
                if sql.is_command_disabled(chat.id, self.friendly):
                    return False
                else:
                    return args, filter_result
コード例 #3
0
ファイル: disable.py プロジェクト: toxic-dev0/LyndaRobot
        def check_update(self, update):
            chat = update.effective_chat
            user = update.effective_user

            if super().check_update(update):

                # Should be safe since check_update passed.
                command = update.effective_message.text_html.split(
                    None, 1)[0][1:].split('@')[0]

                # disabled, admincmd, user admin
                if sql.is_command_disabled(chat.id, command):
                    if command in ADMIN_CMDS and is_user_admin(chat, user.id):
                        return True

                # not disabled
                else:
                    return True
コード例 #4
0
ファイル: disable.py プロジェクト: sandidias/Chizuru
        def check_update(self, update):
            if not isinstance(update, Update) or not update.effective_message:
                return
            message = update.effective_message

            if message.text and len(message.text) > 1:
                fst_word = message.text.split(None, 1)[0]
                if len(fst_word) > 1 and any(
                        fst_word.startswith(start) for start in CMD_STARTERS):
                    args = message.text.split()[1:]
                    command = fst_word[1:].split("@")
                    command.append(message.bot.username)

                    if (command[0].lower() not in self.command
                            or command[1].lower() !=
                            message.bot.username.lower()):
                        return None

                    filter_result = self.filters(update)
                    if filter_result:
                        chat = update.effective_chat
                        user = update.effective_user
                        # disabled, admincmd, user admin
                        if sql.is_command_disabled(chat.id,
                                                   command[0].lower()):
                            # check if command was disabled
                            is_disabled = command[
                                0] in ADMIN_CMDS and is_user_admin(
                                    chat, user.id)
                            if not is_disabled:
                                return None
                            else:
                                return args, filter_result

                        return args, filter_result
                    else:
                        return False