kameloso.plugins.same

This is an example toy plugin to showcase how one could be written to react to non-!command messages.

In the first approach (version MatchByStringComparison), the function is annotated to be called on all channel messages, and the body has to decide whether or not to react to it and reply.

In the second approach (version MatchWithRegex), the function is only called if the incoming message matched its regular expression, so the body can safely assume it should always react and reply.

Members

Classes

SamePlugin
class SamePlugin

The Same toy plugin, that replies to the text "same" with "same".

Functions

initResources
void initResources(SamePlugin plugin)

Initialises the Same plugin's resources.

initialise
void initialise(SamePlugin plugin)

Initialises the Same plugin. Do whatever you want here.

onAnyMessage
void onAnyMessage(SamePlugin plugin, IRCEvent event)

Reacts to the message "same" by agreeing with "same".

onBusMessage
void onBusMessage(SamePlugin plugin, string header, Sendable content)

Catches bus messages.

onRegexMessageSame
void onRegexMessageSame(SamePlugin plugin, IRCEvent event)

Reacts to the messages which match the text "same" with some optional punctuation afterwards.

postprocess
auto postprocess(SamePlugin plugin, IRCEvent event)

Postprocesses events.

reload
void reload(SamePlugin plugin)

Reloads the Same plugin.

setup
void setup(SamePlugin plugin)

Sets up the Same plugin. Think of it as a constructor.

teardown
void teardown(SamePlugin plugin)

Tears down the Same plugin. Think of it as a destructor.

tick
auto tick(SamePlugin plugin, Duration duration)

Called on each iteration of the main loop.

Imports

format (from std.format)
public import std.format : format;
Undocumented in source.

Structs

SameSettings
struct SameSettings

Settings for the Same plugin. These are automatically read from and written to disk by other parts of the program as long as it is annotated @Settings.

See Also

Meta