# Path: bottery/exceptions.py
# class ValidationError(Exception):
#     pass


import re
from bottery.exceptions import ValidationError
class CaseSensitiveOptionMixin:
    def clean_case_senstive(self):
        if not self.kwargs.get('case_sensitive'):
            self.message.text = self.message.text.lower()


class PlatformsOptionMixin:
    def clean_platforms(self):
        platforms = self.kwargs.get('platforms')

        if platforms is None:
            return

        if not isinstance(platforms, (list, tuple,)):
            raise Exception('platforms option must be a list or a tuple')

        if self.message.platform not in platforms:
            raise ValidationError('message not from {}'.format(platforms))


class BaseHandler(PlatformsOptionMixin):
    def __init__(self, pattern=None, view=None, *args, **kwargs):
        self.pattern = pattern
        self.view = view
        self.kwargs = kwargs

    def check(self, message):
        self.message = message
        try:
            self.full_clean()

# Path: bottery/exceptions.py
# class ValidationError(Exception):
#     pass


# Path: bottery/handlers.py
import re
from bottery.exceptions import ValidationError

class CaseSensitiveOptionMixin:
    def clean_case_senstive(self):
        if not self.kwargs.get('case_sensitive'):
            self.message.text = self.message.text.lower()


class PlatformsOptionMixin:
    def clean_platforms(self):
        platforms = self.kwargs.get('platforms')

        if platforms is None:
            return

        if not isinstance(platforms, (list, tuple,)):
            raise Exception('platforms option must be a list or a tuple')

        if self.message.platform not in platforms:
            raise ValidationError('message not from {}'.format(platforms))


class BaseHandler(PlatformsOptionMixin):
    def __init__(self, pattern=None, view=None, *args, **kwargs):
        self.pattern = pattern
        self.view = view
        self.kwargs = kwargs

    def check(self, message):
        self.message = message
        try:
            self.full_clean()

        except ValidationError: