The plugin implement this interface will be called before handling an event. You can use this interface to implement a guard for events.
class BlacklistGuardPlugin implements BeforeHandleEventPlugin { private blacklist = [ // ... ]; beforeHandleEvent(event) { const canHandle = !this.blacklist.includes(event.pubkey); return { canHandle, message: canHandle ? undefined : 'block: you are blacklisted', }; }} Copy
class BlacklistGuardPlugin implements BeforeHandleEventPlugin { private blacklist = [ // ... ]; beforeHandleEvent(event) { const canHandle = !this.blacklist.includes(event.pubkey); return { canHandle, message: canHandle ? undefined : 'block: you are blacklisted', }; }}
This method will be called before handling an event.
The event will be handled
The plugin implement this interface will be called before handling an event. You can use this interface to implement a guard for events.
Example