Listener
public struct Listener<T, I, D> : EventListeners where T : _Event, I == T.ContentType, D == T.D
Listener used to listen to specific hook events.
Listener(Discord.messageCreate) { ... }
Listener(MyHook.myCustomEvent) { ... }
-
Create new
Listener
.Declaration
Swift
public init(_ event: T, _ closure: @escaping EventHandler<D, I>)
Parameters
event
Event to listen for.
closure
Closure to invoke when receiving event
T
. -
Create new
Listener
.Declaration
Swift
public init(_ event: T, _ closure: @escaping SyncEventHandler<D, I>)
Parameters
event
Event to listen for.
closure
Closure to invoke when receiving event
T
. -
Declaration
Swift
public func register(to h: SwiftHooks)
-
Declaration
Swift
public func register(to h: _Hook)