kameloso.plugins.common.awareness

Awareness mixins, for plugins to mix in to extend behaviour and enjoy a considerable degree of automation.

These are used for plugins to mix in book-keeping of users and channels.

Members

Functions

onChannelAwarenessChannelModeIs
void onChannelAwarenessChannelModeIs(IRCPlugin plugin, IRCEvent event)

Adds the modes of a channel to a tracked channel's mode list.

onChannelAwarenessCreationTime
void onChannelAwarenessCreationTime(IRCPlugin plugin, IRCEvent event)

Stores the timestamp of when a channel was created.

onChannelAwarenessJoin
void onChannelAwarenessJoin(IRCPlugin plugin, IRCEvent event)

Adds a user as being part of a channel when they join it.

onChannelAwarenessMode
void onChannelAwarenessMode(IRCPlugin plugin, IRCEvent event)

Sets a mode for a channel.

onChannelAwarenessModeLists
void onChannelAwarenessModeLists(IRCPlugin plugin, IRCEvent event)

Adds users of a certain "list" mode to a tracked channel's list of modes (banlist, exceptlist, invitelist, etc).

onChannelAwarenessNamesReply
void onChannelAwarenessNamesReply(IRCPlugin plugin, IRCEvent event)

Adds users as being part of a channel upon receiving the reply from the request for a list of all the participants.

onChannelAwarenessNick
void onChannelAwarenessNick(IRCPlugin plugin, IRCEvent event)

Upon someone changing nickname, update their entry in the IRCPluginState.users

associative array to point to the new nickname.

onChannelAwarenessPart
void onChannelAwarenessPart(IRCPlugin plugin, IRCEvent event)

Removes a user from being part of a channel when they leave it.

onChannelAwarenessQuit
void onChannelAwarenessQuit(IRCPlugin plugin, IRCEvent event)

Removes a user from all tracked channels if they disconnect.

onChannelAwarenessSelfjoin
void onChannelAwarenessSelfjoin(IRCPlugin plugin, IRCEvent event)

Create a new IRCChannel in the the IRCPlugin's IRCPluginState.channels

associative array when the bot joins a channel.

onChannelAwarenessSelfpart
void onChannelAwarenessSelfpart(IRCPlugin plugin, IRCEvent event)

Removes an IRCChannel from the internal list when the bot leaves it.

onChannelAwarenessTopic
void onChannelAwarenessTopic(IRCPlugin plugin, IRCEvent event)

Update the entry for an IRCChannel if someone changes the topic of it.

onChannelAwarenessWhoReply
void onChannelAwarenessWhoReply(IRCPlugin plugin, IRCEvent event)

Adds a user as being part of a channel upon receiving the reply from the request for info on all the participants.

onMinimalAuthenticationAccountInfoTarget
void onMinimalAuthenticationAccountInfoTarget(IRCPlugin plugin, IRCEvent event)

Replays any queued Replays awaiting the result of a WHOIS query. Before that, records the user's services account by saving it to the user's IRCClient in the IRCPlugin's IRCPluginState.users associative array.

onMinimalAuthenticationUnknownCommandWHOIS
void onMinimalAuthenticationUnknownCommandWHOIS(IRCPlugin plugin, IRCEvent event)

Clears all queued Replays if the server says it doesn't support WHOIS at all.

onTwitchAwarenessUserCarrierImpl
void onTwitchAwarenessUserCarrierImpl(IRCPlugin plugin, string channelName, IRCUser user)

Catch a user from normal Twitch events.

onUserAwarenessCatchSender
void onUserAwarenessCatchSender(IRCPlugin plugin, IRCEvent event)

Adds a user to the IRCPlugin's IRCPluginState.users array, potentially including their services account name.

onUserAwarenessCatchTarget
void onUserAwarenessCatchTarget(IRCPlugin plugin, IRCEvent event)

Catches a user's information and saves it in the plugin's IRCPluginState.users

array of IRCUsers.

onUserAwarenessEndOfList
void onUserAwarenessEndOfList(IRCPlugin plugin, IRCEvent event)

Rehashes, or optimises, the IRCPlugin's IRCPluginState.users

associative array upon the end of a WHO or a NAMES list.

onUserAwarenessNamesReply
void onUserAwarenessNamesReply(IRCPlugin plugin, IRCEvent event)

Catch users in a reply for the request for a NAMES list of all the participants in a channel.

onUserAwarenessNick
void onUserAwarenessNick(IRCPlugin plugin, IRCEvent event)

Upon someone changing nickname, update their entry in the IRCPlugin's IRCPluginState.users

array to point to the new nickname.

onUserAwarenessQuit
void onUserAwarenessQuit(IRCPlugin plugin, IRCEvent event)

Removes a user's IRCUser entry from a plugin's user list upon them disconnecting.

Mixin templates

ChannelAwareness
mixintemplate ChannelAwareness(ChannelPolicy channelPolicy = ChannelPolicy.home, Flag!"debug_" debug_ = No.debug_, string module_ = __MODULE__)

Implements *channel awareness* in a plugin module.

MinimalAuthentication
mixintemplate MinimalAuthentication(Flag!"debug_" debug_ = No.debug_, string module_ = __MODULE__)

Implements triggering of queued events in a plugin module, based on user details such as account or hostmask.

TwitchAwareness
mixintemplate TwitchAwareness(ChannelPolicy channelPolicy = ChannelPolicy.home, Flag!"debug_" debug_ = No.debug_, string module_ = __MODULE__)
Undocumented in source.
TwitchAwareness
mixintemplate TwitchAwareness(ChannelPolicy channelPolicy = ChannelPolicy.home, Flag!"debug_" debug_ = No.debug_, string module_ = __MODULE__)

No-op mixin of version !TwitchSupport TwitchAwareness.

UserAwareness
mixintemplate UserAwareness(ChannelPolicy channelPolicy = ChannelPolicy.home, Flag!"debug_" debug_ = No.debug_, string module_ = __MODULE__)

Implements *user awareness* in a plugin module.

Examples

import kameloso.plugins.common;
import kameloso.plugins.common.awareness;

@Settings struct FooSettings { /* ... */ }

@(IRCEventHandler()
    .onEvent(IRCEvent.Type.CHAN)
    .permissionsRequired(Permissions.anyone)
    .channelPolicy(ChannelPolicy.home)
    .addCommand(
        IRCEventHandler.Command()
            .word("foo")
            .policy(PrefixPolicy.prefixed)
    )
)
void onFoo(FooPlugin plugin, const ref IRCEvent event)
{
    // ...
}

mixin UserAwareness;
mixin ChannelAwareness;

final class FooPlugin : IRCPlugin
{
    FooSettings fooSettings;

    // ...

    mixin IRCPluginImpl;
}

See Also

Meta