exports

exports

Abstract class for a command

Constructor

new exports()

Source:

Members

channel :Discord.TextChannel

The Discord channel that this game is played in.

Source:
See:
Type:

client :Discord.Client

The Discord client that this game belongs to.

Source:
See:
Type:

collectors :Array.<Discord.Collector>

A list of Discord collectors that is cleared when this.clearCollectors(this.collectors) is called. Whenever a MessageCollector or ReactionCollector is created, push it to this.collectors().

Deprecated:
  • Yes
Source:
See:
Type:
  • Array.<Discord.Collector>

ending :Boolean

Helper field that is only true when this.forceStop() is called. This should be used to prevent the game from continuing when unexpectedly ended.

Deprecated:
  • use this.stage = 'ending' instead
Source:
Type:
  • Boolean
Example
const collector = this.channel.createMessageCollector(filter, options)
collector.on('message', message => {
    if(this.ending) return
    // ...
})

gameMaster :Discord.User

The Discord user who initialized this game.

Source:
See:
Type:

gameOptions :Array.<GameOption>

The list of user-configurable options for this game. The configured options will be accessible from this.options[friendlyName] after the init stage.

Source:
Type:
Example
this.gameOptions = [
    {
        friendlyName: 'Categories',
        type: 'checkboxes'
        default: ['Game of Thrones']
        choices: ['Game of Thrones', 'Narnia', 'Lord of the Rings', 'Harry Potter'],
        note: 'Choose the categories for this game.'
    },
    {
        friendlyName: 'Game Mode',
        type: 'radio',
        default: 'Solo',
        choices: ['Team', 'Solo'],
        note: 'In team, players are matched up against each other in groups. In solo, it\'s everyone for themself!'
    },
    {
        friendlyName: 'Timer',
        type: 'number',
        default: 60,
        note: 'Enter a new value in seconds, between 30-60.',
        filter: m => parseInt(m.content) >= 30 && parseInt(m.content) <= 60
    },
    {
        friendlyName: 'Clan Tag',
        type: 'free',
        default: 'none',
        note: 'Enter a new 3-letter clan tag, or type \'none\' for no name.',
        filter: m => m.content.length == 3 || m.content == 'none'
    }
]

metadata :GameMetadata

The metadata from the game, typically read from a metadata.js file.

Source:
Type:
Example
import metadata from './metadata.js'

msg :Discord.Message

The Discord message that initialized this game.

Source:
See:
Type:
  • Discord.Message

playerCount :Object

The game's minimum and maximum player count. Use this.metadata instead.

Properties:
Name Type Description
min Number

The minimum player count for this game.

max Number

The maximum player count for this game.

Deprecated:
  • Yes
Source:
Type:
  • Object

players :Discord.Collection

The collection of players who are added to this game during the join phase.

Source:
See:
Type:
  • Discord.Collection

playersToAdd :Array

An array of players that are queued to be added, populated using the this.addPlayer() command

Source:
Type:
  • Array

playersToKick :Array

An array of players that are queued to be added, populated using the this.removePlayer() command

Source:
Type:
  • Array

settings

Game-specific settings that are configurable on a class level.

Source:

stage :String

The current stage of the game. Default stages include 'join' and 'init'.

Source:
Type:
  • String

UIs :Discord.Collection.<WebUI>

A collection of the UIs, keyed by their game IDs

Source:
Type:
  • Discord.Collection.<WebUI>

exports

Class for a bot command

Constructor

new exports()

Source:

Members

channel :Discord.TextChannel

The Discord channel that this game is played in.

Source:
See:
Type:

client :Discord.Client

The Discord client that this game belongs to.

Source:
See:
Type:

collectors :Array.<Discord.Collector>

A list of Discord collectors that is cleared when this.clearCollectors(this.collectors) is called. Whenever a MessageCollector or ReactionCollector is created, push it to this.collectors().

Deprecated:
  • Yes
Source:
See:
Type:
  • Array.<Discord.Collector>

ending :Boolean

Helper field that is only true when this.forceStop() is called. This should be used to prevent the game from continuing when unexpectedly ended.

Deprecated:
  • use this.stage = 'ending' instead
Source:
Type:
  • Boolean
Example
const collector = this.channel.createMessageCollector(filter, options)
collector.on('message', message => {
    if(this.ending) return
    // ...
})

gameMaster :Discord.User

The Discord user who initialized this game.

Source:
See:
Type:

gameOptions :Array.<GameOption>

The list of user-configurable options for this game. The configured options will be accessible from this.options[friendlyName] after the init stage.

Source:
Type:
Example
this.gameOptions = [
    {
        friendlyName: 'Categories',
        type: 'checkboxes'
        default: ['Game of Thrones']
        choices: ['Game of Thrones', 'Narnia', 'Lord of the Rings', 'Harry Potter'],
        note: 'Choose the categories for this game.'
    },
    {
        friendlyName: 'Game Mode',
        type: 'radio',
        default: 'Solo',
        choices: ['Team', 'Solo'],
        note: 'In team, players are matched up against each other in groups. In solo, it\'s everyone for themself!'
    },
    {
        friendlyName: 'Timer',
        type: 'number',
        default: 60,
        note: 'Enter a new value in seconds, between 30-60.',
        filter: m => parseInt(m.content) >= 30 && parseInt(m.content) <= 60
    },
    {
        friendlyName: 'Clan Tag',
        type: 'free',
        default: 'none',
        note: 'Enter a new 3-letter clan tag, or type \'none\' for no name.',
        filter: m => m.content.length == 3 || m.content == 'none'
    }
]

metadata :GameMetadata

The metadata from the game, typically read from a metadata.js file.

Source:
Type:
Example
import metadata from './metadata.js'

msg :Discord.Message

The Discord message that initialized this game.

Source:
See:
Type:
  • Discord.Message

playerCount :Object

The game's minimum and maximum player count. Use this.metadata instead.

Properties:
Name Type Description
min Number

The minimum player count for this game.

max Number

The maximum player count for this game.

Deprecated:
  • Yes
Source:
Type:
  • Object

players :Discord.Collection

The collection of players who are added to this game during the join phase.

Source:
See:
Type:
  • Discord.Collection

playersToAdd :Array

An array of players that are queued to be added, populated using the this.addPlayer() command

Source:
Type:
  • Array

playersToKick :Array

An array of players that are queued to be added, populated using the this.removePlayer() command

Source:
Type:
  • Array

settings

Game-specific settings that are configurable on a class level.

Source:

stage :String

The current stage of the game. Default stages include 'join' and 'init'.

Source:
Type:
  • String

UIs :Discord.Collection.<WebUI>

A collection of the UIs, keyed by their game IDs

Source:
Type:
  • Discord.Collection.<WebUI>

exports

Class for a game command

Constructor

new exports()

Source:

Members

channel :Discord.TextChannel

The Discord channel that this game is played in.

Source:
See:
Type:

client :Discord.Client

The Discord client that this game belongs to.

Source:
See:
Type:

collectors :Array.<Discord.Collector>

A list of Discord collectors that is cleared when this.clearCollectors(this.collectors) is called. Whenever a MessageCollector or ReactionCollector is created, push it to this.collectors().

Deprecated:
  • Yes
Source:
See:
Type:
  • Array.<Discord.Collector>

ending :Boolean

Helper field that is only true when this.forceStop() is called. This should be used to prevent the game from continuing when unexpectedly ended.

Deprecated:
  • use this.stage = 'ending' instead
Source:
Type:
  • Boolean
Example
const collector = this.channel.createMessageCollector(filter, options)
collector.on('message', message => {
    if(this.ending) return
    // ...
})

gameMaster :Discord.User

The Discord user who initialized this game.

Source:
See:
Type:

gameOptions :Array.<GameOption>

The list of user-configurable options for this game. The configured options will be accessible from this.options[friendlyName] after the init stage.

Source:
Type:
Example
this.gameOptions = [
    {
        friendlyName: 'Categories',
        type: 'checkboxes'
        default: ['Game of Thrones']
        choices: ['Game of Thrones', 'Narnia', 'Lord of the Rings', 'Harry Potter'],
        note: 'Choose the categories for this game.'
    },
    {
        friendlyName: 'Game Mode',
        type: 'radio',
        default: 'Solo',
        choices: ['Team', 'Solo'],
        note: 'In team, players are matched up against each other in groups. In solo, it\'s everyone for themself!'
    },
    {
        friendlyName: 'Timer',
        type: 'number',
        default: 60,
        note: 'Enter a new value in seconds, between 30-60.',
        filter: m => parseInt(m.content) >= 30 && parseInt(m.content) <= 60
    },
    {
        friendlyName: 'Clan Tag',
        type: 'free',
        default: 'none',
        note: 'Enter a new 3-letter clan tag, or type \'none\' for no name.',
        filter: m => m.content.length == 3 || m.content == 'none'
    }
]

metadata :GameMetadata

The metadata from the game, typically read from a metadata.js file.

Source:
Type:
Example
import metadata from './metadata.js'

msg :Discord.Message

The Discord message that initialized this game.

Source:
See:
Type:
  • Discord.Message

playerCount :Object

The game's minimum and maximum player count. Use this.metadata instead.

Properties:
Name Type Description
min Number

The minimum player count for this game.

max Number

The maximum player count for this game.

Deprecated:
  • Yes
Source:
Type:
  • Object

players :Discord.Collection

The collection of players who are added to this game during the join phase.

Source:
See:
Type:
  • Discord.Collection

playersToAdd :Array

An array of players that are queued to be added, populated using the this.addPlayer() command

Source:
Type:
  • Array

playersToKick :Array

An array of players that are queued to be added, populated using the this.removePlayer() command

Source:
Type:
  • Array

settings

Game-specific settings that are configurable on a class level.

Source:

stage :String

The current stage of the game. Default stages include 'join' and 'init'.

Source:
Type:
  • String

UIs :Discord.Collection.<WebUI>

A collection of the UIs, keyed by their game IDs

Source:
Type:
  • Discord.Collection.<WebUI>

exports

Wrapper class for Error.

Constructor

new exports()

Source:

Members

channel :Discord.TextChannel

The Discord channel that this game is played in.

Source:
See:
Type:

client :Discord.Client

The Discord client that this game belongs to.

Source:
See:
Type:

collectors :Array.<Discord.Collector>

A list of Discord collectors that is cleared when this.clearCollectors(this.collectors) is called. Whenever a MessageCollector or ReactionCollector is created, push it to this.collectors().

Deprecated:
  • Yes
Source:
See:
Type:
  • Array.<Discord.Collector>

ending :Boolean

Helper field that is only true when this.forceStop() is called. This should be used to prevent the game from continuing when unexpectedly ended.

Deprecated:
  • use this.stage = 'ending' instead
Source:
Type:
  • Boolean
Example
const collector = this.channel.createMessageCollector(filter, options)
collector.on('message', message => {
    if(this.ending) return
    // ...
})

gameMaster :Discord.User

The Discord user who initialized this game.

Source:
See:
Type:

gameOptions :Array.<GameOption>

The list of user-configurable options for this game. The configured options will be accessible from this.options[friendlyName] after the init stage.

Source:
Type:
Example
this.gameOptions = [
    {
        friendlyName: 'Categories',
        type: 'checkboxes'
        default: ['Game of Thrones']
        choices: ['Game of Thrones', 'Narnia', 'Lord of the Rings', 'Harry Potter'],
        note: 'Choose the categories for this game.'
    },
    {
        friendlyName: 'Game Mode',
        type: 'radio',
        default: 'Solo',
        choices: ['Team', 'Solo'],
        note: 'In team, players are matched up against each other in groups. In solo, it\'s everyone for themself!'
    },
    {
        friendlyName: 'Timer',
        type: 'number',
        default: 60,
        note: 'Enter a new value in seconds, between 30-60.',
        filter: m => parseInt(m.content) >= 30 && parseInt(m.content) <= 60
    },
    {
        friendlyName: 'Clan Tag',
        type: 'free',
        default: 'none',
        note: 'Enter a new 3-letter clan tag, or type \'none\' for no name.',
        filter: m => m.content.length == 3 || m.content == 'none'
    }
]

metadata :GameMetadata

The metadata from the game, typically read from a metadata.js file.

Source:
Type:
Example
import metadata from './metadata.js'

msg :Discord.Message

The Discord message that initialized this game.

Source:
See:
Type:
  • Discord.Message

playerCount :Object

The game's minimum and maximum player count. Use this.metadata instead.

Properties:
Name Type Description
min Number

The minimum player count for this game.

max Number

The maximum player count for this game.

Deprecated:
  • Yes
Source:
Type:
  • Object

players :Discord.Collection

The collection of players who are added to this game during the join phase.

Source:
See:
Type:
  • Discord.Collection

playersToAdd :Array

An array of players that are queued to be added, populated using the this.addPlayer() command

Source:
Type:
  • Array

playersToKick :Array

An array of players that are queued to be added, populated using the this.removePlayer() command

Source:
Type:
  • Array

settings

Game-specific settings that are configurable on a class level.

Source:

stage :String

The current stage of the game. Default stages include 'join' and 'init'.

Source:
Type:
  • String

UIs :Discord.Collection.<WebUI>

A collection of the UIs, keyed by their game IDs

Source:
Type:
  • Discord.Collection.<WebUI>

exports

Extensible library for collection of usage statistics and anonymous user data.

Constructor

new exports()

Source:

Members

channel :Discord.TextChannel

The Discord channel that this game is played in.

Source:
See:
Type:

client :Discord.Client

The Discord client that this game belongs to.

Source:
See:
Type:

collectors :Array.<Discord.Collector>

A list of Discord collectors that is cleared when this.clearCollectors(this.collectors) is called. Whenever a MessageCollector or ReactionCollector is created, push it to this.collectors().

Deprecated:
  • Yes
Source:
See:
Type:
  • Array.<Discord.Collector>

ending :Boolean

Helper field that is only true when this.forceStop() is called. This should be used to prevent the game from continuing when unexpectedly ended.

Deprecated:
  • use this.stage = 'ending' instead
Source:
Type:
  • Boolean
Example
const collector = this.channel.createMessageCollector(filter, options)
collector.on('message', message => {
    if(this.ending) return
    // ...
})

gameMaster :Discord.User

The Discord user who initialized this game.

Source:
See:
Type:

gameOptions :Array.<GameOption>

The list of user-configurable options for this game. The configured options will be accessible from this.options[friendlyName] after the init stage.

Source:
Type:
Example
this.gameOptions = [
    {
        friendlyName: 'Categories',
        type: 'checkboxes'
        default: ['Game of Thrones']
        choices: ['Game of Thrones', 'Narnia', 'Lord of the Rings', 'Harry Potter'],
        note: 'Choose the categories for this game.'
    },
    {
        friendlyName: 'Game Mode',
        type: 'radio',
        default: 'Solo',
        choices: ['Team', 'Solo'],
        note: 'In team, players are matched up against each other in groups. In solo, it\'s everyone for themself!'
    },
    {
        friendlyName: 'Timer',
        type: 'number',
        default: 60,
        note: 'Enter a new value in seconds, between 30-60.',
        filter: m => parseInt(m.content) >= 30 && parseInt(m.content) <= 60
    },
    {
        friendlyName: 'Clan Tag',
        type: 'free',
        default: 'none',
        note: 'Enter a new 3-letter clan tag, or type \'none\' for no name.',
        filter: m => m.content.length == 3 || m.content == 'none'
    }
]

metadata :GameMetadata

The metadata from the game, typically read from a metadata.js file.

Source:
Type:
Example
import metadata from './metadata.js'

msg :Discord.Message

The Discord message that initialized this game.

Source:
See:
Type:
  • Discord.Message

playerCount :Object

The game's minimum and maximum player count. Use this.metadata instead.

Properties:
Name Type Description
min Number

The minimum player count for this game.

max Number

The maximum player count for this game.

Deprecated:
  • Yes
Source:
Type:
  • Object

players :Discord.Collection

The collection of players who are added to this game during the join phase.

Source:
See:
Type:
  • Discord.Collection

playersToAdd :Array

An array of players that are queued to be added, populated using the this.addPlayer() command

Source:
Type:
  • Array

playersToKick :Array

An array of players that are queued to be added, populated using the this.removePlayer() command

Source:
Type:
  • Array

settings

Game-specific settings that are configurable on a class level.

Source:

stage :String

The current stage of the game. Default stages include 'join' and 'init'.

Source:
Type:
  • String

UIs :Discord.Collection.<WebUI>

A collection of the UIs, keyed by their game IDs

Source:
Type:
  • Discord.Collection.<WebUI>

exports

A manager for creating and using WebUIs within games The WebUI manager must be able to communicate with the Express server and each client It will be a property of each client

Constructor

new exports()

Creates a new WebUI Manager

Source:

Members

channel :Discord.TextChannel

The Discord channel that this game is played in.

Source:
See:
Type:

client :Discord.Client

The Discord client that this game belongs to.

Source:
See:
Type:

collectors :Array.<Discord.Collector>

A list of Discord collectors that is cleared when this.clearCollectors(this.collectors) is called. Whenever a MessageCollector or ReactionCollector is created, push it to this.collectors().

Deprecated:
  • Yes
Source:
See:
Type:
  • Array.<Discord.Collector>

ending :Boolean

Helper field that is only true when this.forceStop() is called. This should be used to prevent the game from continuing when unexpectedly ended.

Deprecated:
  • use this.stage = 'ending' instead
Source:
Type:
  • Boolean
Example
const collector = this.channel.createMessageCollector(filter, options)
collector.on('message', message => {
    if(this.ending) return
    // ...
})

gameMaster :Discord.User

The Discord user who initialized this game.

Source:
See:
Type:

gameOptions :Array.<GameOption>

The list of user-configurable options for this game. The configured options will be accessible from this.options[friendlyName] after the init stage.

Source:
Type:
Example
this.gameOptions = [
    {
        friendlyName: 'Categories',
        type: 'checkboxes'
        default: ['Game of Thrones']
        choices: ['Game of Thrones', 'Narnia', 'Lord of the Rings', 'Harry Potter'],
        note: 'Choose the categories for this game.'
    },
    {
        friendlyName: 'Game Mode',
        type: 'radio',
        default: 'Solo',
        choices: ['Team', 'Solo'],
        note: 'In team, players are matched up against each other in groups. In solo, it\'s everyone for themself!'
    },
    {
        friendlyName: 'Timer',
        type: 'number',
        default: 60,
        note: 'Enter a new value in seconds, between 30-60.',
        filter: m => parseInt(m.content) >= 30 && parseInt(m.content) <= 60
    },
    {
        friendlyName: 'Clan Tag',
        type: 'free',
        default: 'none',
        note: 'Enter a new 3-letter clan tag, or type \'none\' for no name.',
        filter: m => m.content.length == 3 || m.content == 'none'
    }
]

metadata :GameMetadata

The metadata from the game, typically read from a metadata.js file.

Source:
Type:
Example
import metadata from './metadata.js'

msg :Discord.Message

The Discord message that initialized this game.

Source:
See:
Type:
  • Discord.Message

playerCount :Object

The game's minimum and maximum player count. Use this.metadata instead.

Properties:
Name Type Description
min Number

The minimum player count for this game.

max Number

The maximum player count for this game.

Deprecated:
  • Yes
Source:
Type:
  • Object

players :Discord.Collection

The collection of players who are added to this game during the join phase.

Source:
See:
Type:
  • Discord.Collection

playersToAdd :Array

An array of players that are queued to be added, populated using the this.addPlayer() command

Source:
Type:
  • Array

playersToKick :Array

An array of players that are queued to be added, populated using the this.removePlayer() command

Source:
Type:
  • Array

settings

Game-specific settings that are configurable on a class level.

Source:

stage :String

The current stage of the game. Default stages include 'join' and 'init'.

Source:
Type:
  • String

UIs :Discord.Collection.<WebUI>

A collection of the UIs, keyed by their game IDs

Source:
Type:
  • Discord.Collection.<WebUI>

exports

The base class for all games, see Getting Started to get started.

Constructor

(abstract) new exports(msg, settings)

Creates a new game.

Source:
Parameters:
Name Type Description
msg Discord.Message

The message object.

settings GameSettings

An optional object with custom settings for the game

Members

channel :Discord.TextChannel

The Discord channel that this game is played in.

Source:
See:
Type:

client :Discord.Client

The Discord client that this game belongs to.

Source:
See:
Type:

collectors :Array.<Discord.Collector>

A list of Discord collectors that is cleared when this.clearCollectors(this.collectors) is called. Whenever a MessageCollector or ReactionCollector is created, push it to this.collectors().

Deprecated:
  • Yes
Source:
See:
Type:
  • Array.<Discord.Collector>

ending :Boolean

Helper field that is only true when this.forceStop() is called. This should be used to prevent the game from continuing when unexpectedly ended.

Deprecated:
  • use this.stage = 'ending' instead
Source:
Type:
  • Boolean
Example
const collector = this.channel.createMessageCollector(filter, options)
collector.on('message', message => {
    if(this.ending) return
    // ...
})

gameMaster :Discord.User

The Discord user who initialized this game.

Source:
See:
Type:

gameOptions :Array.<GameOption>

The list of user-configurable options for this game. The configured options will be accessible from this.options[friendlyName] after the init stage.

Source:
Type:
Example
this.gameOptions = [
    {
        friendlyName: 'Categories',
        type: 'checkboxes'
        default: ['Game of Thrones']
        choices: ['Game of Thrones', 'Narnia', 'Lord of the Rings', 'Harry Potter'],
        note: 'Choose the categories for this game.'
    },
    {
        friendlyName: 'Game Mode',
        type: 'radio',
        default: 'Solo',
        choices: ['Team', 'Solo'],
        note: 'In team, players are matched up against each other in groups. In solo, it\'s everyone for themself!'
    },
    {
        friendlyName: 'Timer',
        type: 'number',
        default: 60,
        note: 'Enter a new value in seconds, between 30-60.',
        filter: m => parseInt(m.content) >= 30 && parseInt(m.content) <= 60
    },
    {
        friendlyName: 'Clan Tag',
        type: 'free',
        default: 'none',
        note: 'Enter a new 3-letter clan tag, or type \'none\' for no name.',
        filter: m => m.content.length == 3 || m.content == 'none'
    }
]

metadata :GameMetadata

The metadata from the game, typically read from a metadata.js file.

Source:
Type:
Example
import metadata from './metadata.js'

msg :Discord.Message

The Discord message that initialized this game.

Source:
See:
Type:
  • Discord.Message

playerCount :Object

The game's minimum and maximum player count. Use this.metadata instead.

Properties:
Name Type Description
min Number

The minimum player count for this game.

max Number

The maximum player count for this game.

Deprecated:
  • Yes
Source:
Type:
  • Object

players :Discord.Collection

The collection of players who are added to this game during the join phase.

Source:
See:
Type:
  • Discord.Collection

playersToAdd :Array

An array of players that are queued to be added, populated using the this.addPlayer() command

Source:
Type:
  • Array

playersToKick :Array

An array of players that are queued to be added, populated using the this.removePlayer() command

Source:
Type:
  • Array

settings

Game-specific settings that are configurable on a class level.

Source:

stage :String

The current stage of the game. Default stages include 'join' and 'init'.

Source:
Type:
  • String

UIs :Discord.Collection.<WebUI>

A collection of the UIs, keyed by their game IDs

Source:
Type:
  • Discord.Collection.<WebUI>