2013-01-15 22:43:09 +01:00
|
|
|
## Users
|
|
|
|
|
|
|
|
Track users.
|
|
|
|
|
|
|
|
### Description
|
|
|
|
|
|
|
|
This module tracks users and their aliases through nick changes and all that
|
2013-04-30 15:53:16 +02:00
|
|
|
kind of thing. It's mainly a utility module for other modules to use.
|
2013-01-15 22:43:09 +01:00
|
|
|
|
|
|
|
### Commands
|
|
|
|
|
|
|
|
#### ~alias [user]
|
|
|
|
If an alias is provided, this command will return the primary user for which
|
|
|
|
this is an alias for. If a primary user is provided, it will return a
|
|
|
|
confirmation of this fact and a count of how many aliases belong to the user.
|
|
|
|
|
|
|
|
#### ~setaliasparent [newparent]
|
|
|
|
Set a nick which is currently serving as an alias to the primary user, while
|
|
|
|
setting what was previously the primary user as an alias of the new primary
|
|
|
|
user. Requires moderator level access by default.
|
|
|
|
|
|
|
|
#### ~mergeusers [primaryuser] [secondaryuser]
|
|
|
|
This command merges two nicks which are recorded as primary users into one user.
|
|
|
|
The secondary user and all of their aliases will be merged under primaryuser.
|
|
|
|
Requires moderator level access by default.
|
|
|
|
|
2013-08-17 19:23:43 +02:00
|
|
|
#### ~addalias [user] [alias]
|
|
|
|
Manually add alias to user.
|
|
|
|
|
|
|
|
#### ~removealias [alias]
|
|
|
|
Remove alias from user.
|
|
|
|
|
2013-01-15 22:43:09 +01:00
|
|
|
### API
|
|
|
|
|
2013-04-30 15:53:16 +02:00
|
|
|
#### resolveUser(server, nick, callback)
|
|
|
|
This resolves a given nick to its primary user, returning false if no user
|
|
|
|
record is found in the store associated with the given nickname (either as a
|
|
|
|
primary nick or an alias). The callback is called with one argument, a _user_
|
|
|
|
object or false if no user was found.
|
|
|
|
|
|
|
|
#### getUser(uuid, callback)
|
|
|
|
Get a user by its uuid. Callback is called with one argument, a _user_ object or
|
|
|
|
false if no user was found by that uuid.
|
|
|
|
|
|
|
|
#### getChannel(server, channelName, callback)
|
|
|
|
This resolves a given server and channel name to a particular channel. The
|
|
|
|
callback is called with one argument, a _channel_ object or false if no channel
|
|
|
|
was found with the given name on the given server.
|
|
|
|
|
|
|
|
#### getRandomChannelUser(server, channel, callback)
|
|
|
|
Given a server name and a channel name, this gets a random user from that
|
|
|
|
channel. Callback is called with one argument, a _user_ object or false if no
|
|
|
|
channel was found from the given parameters.
|
|
|
|
|
|
|
|
#### getAllusers(callback)
|
|
|
|
Get a list of all users the bot currently knows about. Callback is called with
|
|
|
|
one argument, a list of user records.
|
|
|
|
|
2013-04-30 16:04:21 +02:00
|
|
|
#### isOnline
|
|
|
|
Is the given nick on the given server currently in the given channel. Callback
|
|
|
|
is called with one argument, a boolean as to whether the nick is currently in
|
|
|
|
the specified place.
|
|
|
|
|
2013-04-30 15:53:16 +02:00
|
|
|
### Data
|
|
|
|
|
|
|
|
#### User Object
|
|
|
|
|
|
|
|
{
|
|
|
|
id: user uuid,
|
|
|
|
primaryNick,
|
|
|
|
currentNick: Current or last used nickname,
|
|
|
|
server,
|
|
|
|
channels: A list of names for channels this user has been in,
|
|
|
|
aliases: A list of known aliases for this user
|
|
|
|
}
|
|
|
|
|
|
|
|
#### Channel Object
|
|
|
|
|
|
|
|
{
|
|
|
|
id: channel uuid,
|
|
|
|
server,
|
|
|
|
name,
|
|
|
|
users: A list of the uuids of users who are in this channel
|
|
|
|
}
|
2013-01-24 20:11:22 +01:00
|
|
|
|
|
|
|
### Events
|
|
|
|
|
2013-05-21 20:39:11 +02:00
|
|
|
#### new_user(user)
|
|
|
|
This is executed when a new user is added to the known users DB.
|
2013-01-24 20:29:13 +01:00
|
|
|
|
2013-05-21 20:39:11 +02:00
|
|
|
#### new_user_alias(user, newNick)
|
|
|
|
When a new user alias is added.
|
|
|
|
|
|
|
|
#### new_channel(channel)
|
|
|
|
Executed when DBot creates a new channel object.
|
|
|
|
|
|
|
|
#### new_channel_user(user, channel)
|
|
|
|
Executed when DBot creates a new channel object.
|