Explorar o código

Fix func not getting called in events (#107)

* Fix func not getting called in NewMessage event

* Call super filter in Raw filter
Roj Serbest %!s(int64=4) %!d(string=hai) anos
pai
achega
8503b7b6c2
Modificáronse 2 ficheiros con 4 adicións e 4 borrados
  1. 1 4
      gramjs/events/Raw.ts
  2. 3 0
      gramjs/events/common.ts

+ 1 - 4
gramjs/events/Raw.ts

@@ -51,9 +51,6 @@ export class Raw extends EventBuilder {
                 return;
             }
         }
-        if (this.func) {
-            return this.func(event);
-        }
-        return event;
+        return super.filter(event);
     }
 }

+ 3 - 0
gramjs/events/common.ts

@@ -127,6 +127,9 @@ export class EventBuilder {
                 return;
             }
         }
+        if (this.func && !this.func(event)) {
+            return;
+        }
         return event;
     }
 }