ChatListener
open class ChatListener
A ChatListener parses commands from the chat room.
-
The commands recognized by this ChatListener.
Declaration
Swift
open let commands: [Command.Type]
-
Undocumented
Declaration
Swift
open class ChatListener
-
The name of the bot. A message must start with this name to be recognized as a command.
Declaration
Swift
open var name = "@FireAlarm"
-
The number of characters of the name that must be included.
For example, if
name
is@FireAlarm
andminNameCharacters
is 4,@FireAlarm
,@Fire
, and@Fir
will all be recognized, but@FirTree
,@Fi
, and@Kyll
will not.Declaration
Swift
open var minNameCharacters = 4
-
A closure to run when the bot shuts down.
Declaration
Swift
open var shutdownHandler: (StopReason) -> () = {reason in}
-
Runs a closure on shutdown.
Declaration
Swift
open func onShutdown(_ handler: @escaping (StopReason) -> ())
-
Tells the bot whether to reboot, shutdown or update.
See moreDeclaration
Swift
public enum StopReason
-
The commands the bot is currently running.
Declaration
Swift
open var runningCommands = [Command]()
-
Process a ChatMessage in the specified room.
Declaration
Swift
open func processMessage(_ room: ChatRoom, message: ChatMessage, isEdit: Bool)
-
Waits for running commands to complete and calls
shutdownHandler
.Declaration
Swift
open func stop(_ reason: StopReason)
Parameters
reason
The reason for the shutdown.
-
Initializes a ChatListener.
Declaration
Swift
public init(commands: [Command.Type])
Parameters
commands
The commands to listen for.