EventController

EventController

Controller for Events

Constructor

new EventController()

Source:

Methods

(async) fetchEventContext(config) → {Object|String}

Source:

Fetches the discord.js object representing the provided context

Parameters:
Name Type Description
config Object

configuration object

Properties
Name Type Description
context Object

context configuration object

event Event

Event for context

Returns:

context object or 'global' for global context

Type
Object | String

init(config)

Source:

Initializes a new EventController

Parameters:
Name Type Description
config Object

configuration object

Properties
Name Type Description
server Esdi

Esdi server instance

(async) initializeIfMissing(server, event, doc)

Source:

Helper method that initializes the database document if missing

Parameters:
Name Type Description
server Esdi

Esdi server instance

event Event

Event for which to initialize database document

doc Object

database document to check before starting

loop()

Source:

Called every Esdi server loop

Listens to Events:

registerDiscordEvents(client)

Source:

Registers Discord Events to the provided discord.js Client

Parameters:
Name Type Description
client external:Client

discord.js Client

(async) start()

Source:

Starts the EventController

Listens to Events:

stop()

Source:

Stops the EventController

Listens to Events:

updateLocalEventContexts(config)

Source:

Updates the interval Event contexts stored on the local Esdi server instance

Parameters:
Name Type Description
config Object

configuration object

Properties
Name Type Description
event Event

Event for which to update available contexts

filterFunc function

function that filters the context array

newContext String

ID of new context to add to array