MafiaModController

sockMafia Mod controller

Author: Yamikuronue
License: MIT

MafiaModController~MafiaModController

The controller class for Mafiabot

Kind: inner class of MafiaModController

new MafiaModController(d)

The constructor

Param Type Description
d sockmafia.src.dao.MafiaDao The dao to use to persist the data

mafiaModController.activate(forum)

Activate the controller

Kind: instance method of MafiaModController

Param Type Description
forum Forum The forum to activate for

mafiaModController.sendRoleCard(command) ⇒ Promise

Sends the contents of the post or chat containing the command to the target users as their role card.

If you, as a bastard mod, wish to omit information from the rolecard set the game option stripCommands to enabled to remove all commands from the role card when sending it to the player

Usage:

!send-rolecard TargetUsername in TargetGame

Kind: instance method of MafiaModController
Returns: Promise - A promise that will resolve when the command is complete

Param Type Description
command Command The command being executed

mafiaModController.setOption(command) ⇒ Promise

Sets various game level configuration options.

Aliases:

  • set-value
  • setvalue
  • option

Usage:

!set-option chats equal enabled in testMafia

Kind: instance method of MafiaModController
Returns: Promise - A promise that will resolve when the command is complete

Param Type Description
command Command The command being executed

mafiaModController.addHandler(command) ⇒ Promise

Add a thread or chat to the game so that commands can be executed in it. Examples: - !add thread 123 testmafia - !add thread 123 to testMafia - !add chat 123 testMafia - !add chat 123 to testMafia - !add this testMafia - !add this to testMafia

Kind: instance method of MafiaModController
Returns: Promise - A promise that will resolve when the command is complete

Param Type Description
command Command The command being executed

mafiaModController.setHandler(command)

Set: set a prperty for a player. No game rules; this sets up rules for voting

Kind: instance method of MafiaModController

Param Type Description
command Sockbot.commands.command The command object

mafiaModController.phaseHandler(command) ⇒ Promise

Next-phase: A mod function that moves to the next phase Must be used in the game thread.

Game rules: - A game can advance to night when it is in the day phase - A game can only be advanced by the mod - When the game is advanced to night, a new day does not start

Kind: instance method of MafiaModController
Returns: Promise - A promise that will resolve when the game is ready

Param Type Description
command commands.command The command that was passed in.

Example

!next-phase

mafiaModController.dayHandler(command) ⇒ Promise

New-day: A mod function that starts a new day Must be used in the game thread.

Game rules: - A game can advance to day when it is in the night phase - A game can advance to night when it is in the day phase - A game can only be advanced by the mod - When the game is advanced to day, a new day starts - When the game is advanced to night, a new day does not start - When a new day starts, the vote counts from the previous day are reset - When a new day starts, the list of players is output for convenience - When a new day starts, the "to-lynch" count is output for convenience

Kind: instance method of MafiaModController
Returns: Promise - A promise that will resolve when the game is ready

Param Type Description
command commands.command The command that was passed in.

Example

!new-day

mafiaModController.killHandler(command) ⇒ Promise

Kill: A mod function that modkills or nightkills a player. Must be used in the game thread.

Game rules: - A player can only be killed if they are already in the game. - A player can only be killed if they are alive. - A player can only be !killed by the mod.

Kind: instance method of MafiaModController
Returns: Promise - A promise that will resolve when the game is ready

Param Type Description
command commands.command The command that was passed in.

Example

!kill playerName

mafiaModController.listNAHandler(command) ⇒ Promise

List Night Actions: A mod function that lists the current night actions. Useful when the mod is ready to take action on them, or for shits and grins in club ded

Kind: instance method of MafiaModController
Returns: Promise - A promise that will resolve when the game is ready

Param Type Description
command commands.command The command that was passed in.

Example

!list-night-actions testMafia

Example

!list-night-actions 123

MafiaModController~logRecoveredError(error)

Log an error that was recovered from

Kind: inner method of MafiaModController

Param Type Description
error Error The error to log

MafiaModController~logDebug(statement)

Log a debug statement

Kind: inner method of MafiaModController

Param Type Description
statement String The statement to log

MafiaModController~advance() ⇒

Advance the day.

Kind: inner method of MafiaModController
Returns: Promise that resolves when the action is complete