SockEvents ⇐ EventEmitter
SockEvents object
All methods from core EventEmitter are preserved, refer to the core api for details.
Extends: EventEmitter
Author: Accalia
License: MIT
- SockEvents ⇐
EventEmitter
- ~onChannel(channel, handler) ⇒
SockEvents
- ~removeChannel(channel, handler) ⇒
SockEvents
- ~removeTopic(topicId, handler) ⇒
SockEvents
- ~onNotification(type, handler) ⇒
SockEvents
- ~removeNotification(type, handler) ⇒
SockEvents
- ~onCommand(type, helpstring, handler) ⇒
SockEvents
- ~removeCommand(command, handler) ⇒
SockEvents
- ~command :
object
- ~messageHandler
- ~topicMessageHandler
- ~notificationHandler
- ~commandHandler
SockEvents~onChannel(channel, handler) ⇒ SockEvents
Register a message-bus channel listener
Kind: inner method of SockEvents
Returns: SockEvents
- SockEvents for chaining calls
Param | Type | Description |
---|---|---|
channel | string |
Message-bus channel to subscribe to |
handler | messageHandler |
Event Handler |
SockEvents~removeChannel(channel, handler) ⇒ SockEvents
Unregister a message-bus channel listener
Kind: inner method of SockEvents
Returns: SockEvents
- SockEvents for chaining calls
Param | Type | Description |
---|---|---|
channel | string |
Message-bus channel to subscribe to |
handler | messageHandler |
Event Handler |
SockEvents~removeTopic(topicId, handler) ⇒ SockEvents
Unregister a message-bus topic listener
Kind: inner method of SockEvents
Returns: SockEvents
- SockEvents for chaining calls
Param | Type | Description |
---|---|---|
topicId | Number |
Numerical ID of topic to subscribe to |
handler | topicMessageHandler |
Event Handler |
SockEvents~onNotification(type, handler) ⇒ SockEvents
Add a notification listener
Kind: inner method of SockEvents
Returns: SockEvents
- SockEvents for chaining calls
Param | Type | Description |
---|---|---|
type | string |
Notification type |
handler | notificationHandler |
Notification handler |
SockEvents~removeNotification(type, handler) ⇒ SockEvents
Remove a notification listener
Kind: inner method of SockEvents
Returns: SockEvents
- SockEvents for chaining calls
Param | Type | Description |
---|---|---|
type | string |
Notification type |
handler | notificationHandler |
Notification handler |
SockEvents~onCommand(type, helpstring, handler) ⇒ SockEvents
Add a notification listener
Kind: inner method of SockEvents
Returns: SockEvents
- SockEvents for chaining calls
Param | Type | Description |
---|---|---|
type | string |
Command name |
helpstring | string |
Short help text for command |
handler | commandHandler |
Command handler |
SockEvents~removeCommand(command, handler) ⇒ SockEvents
Remove a command listener
Kind: inner method of SockEvents
Returns: SockEvents
- SockEvents for chaining calls
Param | Type | Description |
---|---|---|
command | string |
Command type |
handler | commandHandler |
Command handler |
SockEvents~command : object
Parsed Command Data
Kind: inner typedef of SockEvents
Param | Type | Description |
---|---|---|
input | string |
Raw Command Input |
command | string |
Command name |
args | Array.<string> |
Command arguments |
mention | string |
Mention text that was included in command |
post | external.posts.CleanedPost |
Post that triggered the command |
SockEvents~messageHandler
Discourse message-bus channel message handler
Kind: inner typedef of SockEvents
Param | Type | Description |
---|---|---|
message | externals.messageBus.message |
Message to handle |
SockEvents~topicMessageHandler
Discourse message-bus topic message handler
Kind: inner typedef of SockEvents
Param | Type | Description |
---|---|---|
message | externals.messageBus.postMessage |
Payload of message |
topic | externals.topics.Topic |
Topic containing post |
post | externals.posts.CleanedPost |
Post that triggered the message |
SockEvents~notificationHandler
Notification Handler
Kind: inner typedef of SockEvents
Param | Type | Description |
---|---|---|
notification | external.notifications.notification |
Received notification |
[topic] | external.topics.Topic |
Topic data for received notification |
[post] | external.posts.CleanedPost |
Post data for recieved notification |
SockEvents~commandHandler
Command handler
Kind: inner typedef of SockEvents
Param | Type | Description |
---|---|---|
command | command |
Triggering Command |