Oneliner

Oneliner definition struct.

Members

Enums

OnelinerType
enum OnelinerType

The different kinds of Oneliners. Either one that yields a random response each time, or one that yields a ordered one.

Functions

getResponse
auto getResponse()

Yields a response from the responses array, depending on the type of this oneliner.

nextOrderedResponse
auto nextOrderedResponse()

Yields an ordered response from the responses array. Which response is selected depends on the value of position.

randomResponse
auto randomResponse()

Yields a random response from the responses array.

toJSON
auto toJSON()

Serialises this Oneliner into a JSONValue.

Static functions

fromJSON
auto fromJSON(JSONValue json)

Deserialises a Oneliner from a JSONValue.

resolveOnelinerTypestring
auto resolveOnelinerTypestring(string input, OnelinerType type)

Resolves a string to a OnelinerType.

stripPrefix
auto stripPrefix(string trigger, string prefix)

Strips the prefix from a trigger word.

Variables

alias_
string alias_;

Alias of another oneliner.

cooldown
uint cooldown;

How many seconds must pass between two invocations of a oneliner. Introduces an element of hysteresis.

lastTriggered
long lastTriggered;

UNIX timestamp of when the oneliner last fired.

position
size_t position;

The current position, kept to keep track of what response should be yielded next in the case of ordered oneliners.

responses
string[] responses;

Array of responses.

trigger
string trigger;

Trigger word for this oneliner.

type
OnelinerType type;

What type of Oneliner this is.