This is your plugin to the outside world, the only thing publicly visible in the entire module. It only serves as a way of proxying calls to our top-level private functions, as well as to house plugin-specific and -private variables that we want to keep out of top-level scope for the sake of modularity. If the only state is in the plugin, several plugins of the same kind can technically be run alongside each other, which would allow for several bots to be run in parallel. This is not yet supported but there's fundamentally nothing stopping it.
Complementary to UserAwareness is ChannelAwareness, which will add in book-keeping about the channels the bot is in, their topics, modes, and list of participants. Channel awareness requires user awareness, but not the other way around.
UserAwareness is a mixin template; it proxies to a few functions defined in kameloso.plugins.common.awareness to deal with common book-keeping that every plugin *that wants to keep track of users* need. If you don't want to track which users you have seen (and are visible to you now), you don't need this.
Mixes in a module constructor that registers this module's plugin to be instantiated on program startup/connect.
Flag denoting that UserAwareness
has been mixed in.
Proxies to onUserAwarenessQuit.
Proxies to onUserAwarenessNick.
Proxies to onUserAwarenessCatchTarget.
Proxies to onUserAwarenessCatchSender.
Proxies to onUserAwarenessNamesReply.
Proxies to onUserAwarenessEndOfList.
Proxies to onUserAwarenessPing.
Flag denoting that ChannelAwareness has been mixed in.
Proxies to onChannelAwarenessSelfjoin.
Proxies to onChannelAwarenessSelfpart.
Proxies to onChannelAwarenessJoin.
Proxies to onChannelAwarenessPart.
Proxies to onChannelAwarenessNick.
Proxies to onChannelAwarenessQuit.
Proxies to onChannelAwarenessTopic.
Proxies to onChannelAwarenessCreationTime.
Proxies to onChannelAwarenessMode.
Proxies to onChannelAwarenessWhoReply.
Proxies to onChannelAwarenessNamesReply.
Proxies to onChannelAwarenessModeLists.
Proxies to onChannelAwarenessChannelModeIs.
The Seen plugin implements "seen"; the ability for someone to query when a given nickname was last encountered online.
We will implement this by keeping an internal long[string] associative array of timestamps keyed by nickname. Whenever we see a user do something, we will update his or her timestamp to the current time. We'll save this array to disk when closing the program and read it from file when starting it, as well as saving occasionally once every few (compile time-configurable) minutes.
We will rely on the ChanQueriesService to query channels for full lists of users upon joining new ones, including the ones we join upon connecting. Elsewise, a completely silent user will never be recorded as having been seen, as they would never be triggering any of the functions we define to listen to. (There's a setting to ignore non-chatty events, as we'll see later.)
kameloso does primarily not use callbacks, but instead annotates functions with UDAs of IRC event *types*. When an event is incoming it will trigger the function(s) annotated with its type.
Callback delegates and Fibers *are* supported but are not the primary way to trigger event handler functions. Such can however be registered to process on incoming events, or scheduled with a reasonably high degree of precision.