getUser

Retrieves an IRCUser from the passed plugin's users associative array. If none exists, returns a minimally viable IRCUser with the passed nickname as its only value.

On Twitch, if no user was found, it additionally tries to look up the passed nickname as if it was a display name.

getUser
(,
const string specified
)

Parameters

plugin IRCPlugin

The current IRCPlugin, whatever it is.

specified string

The name of a user to look up.

Return Value

Type: auto

An IRCUser that matches the passed nickname, from the passed plugin's arrays. A minimally viable IRCUser if none was found.

Examples

final class MyPlugin : IRCPlugin
{
    mixin IRCPluginImpl;
}

IRCPluginState state;
IRCPlugin plugin = new MyPlugin(state);

IRCUser newUser;
newUser.nickname = "nickname";
newUser.displayName = "NickName";
plugin.state.users["nickname"] = newUser;

immutable sameUser = getUser(plugin, "nickname");
assert(newUser == sameUser);

version(TwitchSupport)
{
    plugin.state.server.daemon = IRCServer.Daemon.twitch;
    immutable sameAgain = getUser(plugin, "NickName");
    assert(newUser == sameAgain);
}

Meta