Class: Action

HungryGames~ Action


new Action(handler [, delay])

Create action.
Parameters:
Name Type Argument Default Description
handler HungryGames~Action~ActionHandler Action handler override.
delay number <optional>
0 Delay calling the handler by this many milliseconds after triggered.
Source:

Classes

GiveRoleAction
RunCommandAction
SendAutoplayingMessageAlertAction
SendDayEndMessageAction
SendDayStartMessageAction
SendEventMessageAction
SendMessageAction
SendPlayerRankMessageAction
SendStatusListAction
SendTeamRankMessageAction
SendVictorAction
TakeRoleAction

Members


<static> actionList :Array.<{path: string, pickable: boolean}>

List of available actions.
Type:
  • Array.<{path: string, pickable: boolean}>
Source:

<static> triggerMeta :object.<{order: number, types: Array.<string>, description: string}>

Map of metadata for available triggers, to aid with UIs.
Type:
  • object.<{order: number, types: Array.<string>, description: string}>
Source:

serializable

Convert this object to serializable format for saving to file. Injects data from `this._saveData`.
Source:

Methods


<abstract, static> create(client, id, obj)

Create action from save data.
Parameters:
Name Type Description
client external:Discord~Client Bot client context to get object references.
id string Guild ID this action is for.
obj object The parsed data from file.
Source:
Returns:
The created action.
Type
HungryGames~Action

<static> createID()

Generate an ID for an Action. Does not check for collisions.
Source:
Returns:
Generated ID.
Type
string

<static> from(client, id, obj)

Create an Action object from save data. Looks up action from HungryGames~Action~actionList.
Parameters:
Name Type Description
client external:Discord~Client Client reference for obtaining discord object references.
id string The Guild ID this action is for.
obj object The object data from save file.
Source:
Returns:
The created action, or null if failed to find the action.
Type
Action

trigger(hg, game [, args])

Trigger the action to be performed.
Parameters:
Name Type Argument Description
hg HungryGames HG context.
game HungryGames~GuildGame Game context.
args * <optional>
<repeatable>
Additional arguments to pass.
Source:

Type Definitions


ActionHandler(hg, game)

Handler function for a generic action.
Parameters:
Name Type Description
hg HungryGames HG context.
game HungryGames~GuildGame Game context.
Source:

ChannelActionHandler(hg, game, channel)

Handler function for a action to be performed on the game channel.
Parameters:
Name Type Description
hg HungryGames HG context.
game HungryGames~GuildGame Game context.
channel external:Discord~TextChannel Channel context.
Source: