Ejemplo n.º 1
0
    def decorator(func):
        async def wrapper(check):
            if check.edit_date:
                return
            if check.fwd_from:
                return
            if check.is_group or check.is_private:
                pass
            else:
                print("i don't work in channels")
                return
            users = gbanned.find({})
            for c in users:
                if check.sender_id == c["user"]:
                    return
            try:
                await func(check)
                try:
                    LOAD_PLUG[file_test].append(func)
                except Exception:
                    LOAD_PLUG.update({file_test: [func]})
            except BaseException:
                return
            else:
                pass

        tbot.add_event_handler(wrapper, events.NewMessage(**args))
        return wrapper
Ejemplo n.º 2
0
 def decorator(func):
     tbot.add_event_handler(func, events.CallbackQuery(**args))
     return func
Ejemplo n.º 3
0
 def decorator(func):
     tbot.add_event_handler(func, events.InlineQuery(**args))
     return func
Ejemplo n.º 4
0
 def decorator(func):
     tbot.add_event_handler(func, events.UserUpdate(**args))
     return func
Ejemplo n.º 5
0
 def decorator(func):
     tbot.add_event_handler(func, events.ChatAction(**args))
     return func
Ejemplo n.º 6
0
 def decorator(func):
     tbot.add_event_handler(func, events.NewMessage(**args))
     return func