from ...models import Message, Callback_Query
from ..creator import new_condition

@new_condition(use=(Message, Callback_Query))
def public(event: Message | Callback_Query):
    if isinstance(event, Message):
        if event.chat.type.lower() in ('channel', 'group'):
            return True
        return False
    elif isinstance(event, Callback_Query):
        if event.message.chat.type.lower() in ('channel', 'group'):
            return True
        return False
