user api¶
-
class
User(nick, client, network)¶ Arguments: - nick (string) – The users nickname
- client (object) – Client object.
- network (object) – Network object.
Create a new user object.
-
User.toString()¶ Returns string hostmask: Hostmask of the user.
-
User.getNick()¶ Returns string Nick: Nick of the user.
-
User.getNetwork()¶ Returns string Network: Network of the user.
-
User.getUsername()¶ Returns string Username: Username of the user.
-
User.getRealname()¶ Returns string Realname: Realname of the user.
-
User.getHostname()¶ Returns string Hostname: Hostname of the user.
-
User.getAccountName()¶ Returns string AccountName: AccountName of the user.
-
User.getChannels()¶ Returns object Channels: Channels of the user. {'#channel': ['~']}
-
User.getServer()¶ Returns string Server: Server the user is connected to.
-
User.getServerInfo()¶ Returns string ServerInfo: ServerInfo of the Server the user is connected to.
-
User.getAway()¶ Returns boolean Away: Away status of the user.
-
User.getAccount()¶ Returns string Account: Account of the user.
-
User.isRegistered()¶ Returns boolean registered: Registration status of the user.
-
User.isUsingSecureConnection()¶ Returns boolean secureConnection: SSL status of the user (on/off).
-
User.getIdle()¶ Returns int Idle: Idletime of the user.
-
User.getSignonTime()¶ Returns string SignonTime: SignonTime of the user.
-
User.isOper()¶ Returns boolean oper: Oper status of the user.
-
User.notice(msg)¶ Arguments: - msg (string) – Notice message to send to the user.
-
User.say(msg)¶ Arguments: - msg (string) – Message to send to the user.
-
User.whois(fn)¶ Arguments: - fn (function) – The callback function to be called when the call has been finished.
events¶
-
nick¶
The nick event, fired when someone changes nickname.
Event attributes:
user- User who changed nick.oldNick- Their old nickname.
Example:
client.on('nick', function (err, event) {
console.log(oldNick + " is now " + event.user.getNick());
});
-
whois¶
The whois event, fired when the whois response is received from the server.
Event attributes:
whoismap-{user: whois_data}.
Example:
client.on('whois', function (err, event) {
if (err) console.err("Couldn't whois:", err);
console.log(event);
});
functions¶
-
getUser(nick, network)¶ Arguments: - nick (string) – The user you want to get by nickname.
- network (object) – The network to execute the command on.
Get a user object by nickname.
-
isUser(user)¶ Arguments: - user (object) – The user object you want to check.
Checks if the passed object is a valid user object.
-
whois(target, network, fn) Arguments: - target (object) – The
channeloruserobject to send this message to. - network (object) – The network to execute the command on.
- fn (function) – The callback function to be called when the call has been finished.
- target (object) – The
Send a whois request to the server.
-
identify(username, password, network, fn)¶ Arguments: - username (string) – The username to identify with.
- password (string) – The password to identify with.
- network (object) – The network to execute the command on.
- fn (function) – The callback function to be called when the call has been finished.
Identifies the user with nickserv.
-
nick(nick, network, fn) Arguments: - nick (string) – The nickname you want to use now.
- network (object) – The network to execute the command on.
- fn (function) – The callback function to be called when the call has been finished.
Change your nickname to the specified nick.