from __future__ import annotations

from typing import Callable, Optional
import rubio.core


class OnEditedMessage:
    def on_edited_message(
        self: rubio.core.Client,
        filters: Optional[rubio.core.filters.Filter] = None,
        group: int = 0
    ):
        def decorator(func: Callable):
            handler = rubio.core.Handler(
                callback=func,
                filters=filters
            )

            self.dispatcher.add_handler(
                rubio.core.enums.HandlerType.EDITED,
                handler,
                group
            )

            return func

        return decorator