channel api¶
-
class
Channel
(name, client, network)¶ Arguments: - name (string) – The channel name
- client (object) – Client object.
- network (object) – Network object.
Create a new channel object.
-
Channel.
toString
()¶ Returns string hostmask: Hostmask of the channel.
-
Channel.
getName
()¶ Returns string Name: Name of the channel.
-
Channel.
getTopic
()¶ Returns string Topic: Topic of the channel.
-
Channel.
getNames
()¶ Returns object names: Nicks in the channel: {'nick': ['~']}
-
Channel.
getNetwork
()¶ Returns string Network: Network of the channel.
-
Channel.
userHasMode
(user, mode)¶ Arguments: - user (object) – The user to check the mode of in the channel.
- mode (string) – The mode to check for.
Returns boolean hasMode: true
if specified user has specified mode.
-
Channel.
isUserInChannel
(user)¶ Arguments: - user (object) – The user to check.
Returns boolean hasMode: true
if specified user is in this channel.
-
Channel.
notice
(msg)¶ Arguments: - msg (string) – Notice message to send to the user.
-
Channel.
say
(msg)¶ Arguments: - msg (string) – Message to send to the user.
-
Channel.
reply
(user, msg)¶ Arguments: - user (object) – User to reply to.
- msg (string) – Message to send to the user.
-
Channel.
kick
(user, reason)¶ Arguments: - user (object) – User to kick from channel.
- reason (string) – Reason for the kick.
-
Channel.
ban
(mask)¶ Arguments: - mask (string) – Hostmask to ban.
-
Channel.
unban
(mask)¶ Arguments: - mask (string) – Hostmask to unban.
events¶
-
invite
¶
The invite
event, fired when someone gets invited by someone.
Event attributes:
channel
- Channel you got invited to.user
- User who sent the invite.target
- Invited user.
Example:
client.on('invite', function (err, event) {
console.log(event.target.getNick() + " got invited to "
+ event.channel.getName() + " by " + event.user.getNick());
});
-
topic
¶
The topic
event, fired when the topic gets changed. (or is originally sent)
Event attributes:
topic
- Current topic.user
- User who changed the topic.time
- Time of topic change.changed
-true
if topic was changed in this event.channel
- Affected channel.network
- Affected network.
Example:
client.on('topic', function (err, event) {
console.log(event.channel.getName() + ":", event.topic);
});
-
join
¶
The join
event, fired when someone joins a channel.
Event attributes:
user
- User who joined.channel
- Channel that was joined.
Example:
client.on('join', function (err, event) {
console.log(event.user.getNick() + " joined " + event.channel.getName());
});
-
names
¶
The names
event, fired when getting users in the channel.
Event attributes:
channel
- Affected channel.names
- List of users in the channel.
Example:
client.on('names', function (err, event) {
console.log(event.channel.getName() + ":", event.names);
});
-
mode
¶
The mode
event, fired when a mode gets changed.
Event attributes:
mode
- Current mode.channel
- Affected channel.by
- User who changed the mode.argument
- Mode argument.adding
- boolean
Example:
client.on('mode', function (err, event) {
console.log(event.channel.getName() + ":", event.mode);
});
-
kick
¶
The kick
event, fired when a user gets kicked.
Event attributes:
channel
- Affected channel.user
- Affected user.by
- User who changed the kick.reason
- Reason for the kick.
Example:
client.on('kick', function (err, event) {
console.log(event.channel.getName() + ":", event.user.getNick(), "was kicked.");
});
-
part
¶
The part
event, fired when a user parts a channel (channels).
Event attributes:
user
- Affected user.channels
- Affected channels (channelList).message
- Part message.
Example:
client.on('part', function (err, event) {
console.log(event.user.getNick(), "parted channels", event.channels);
});
functions¶
-
getChannelList
()¶ Return array channelList: List of channels.
Get a list of channels.
-
getChannel
(name, network)¶ Arguments: - name (object) – The name of the channel you want to get.
- network (object) – The network to execute the command on.
Gets a channel by name.
-
isChannel
(channel)¶ Arguments: - channel (object) – The channel object you want to check.
Checks if the passed object is a valid channel object.
-
invite
(name, channel, network, fn) Arguments: - name (string) – The name of the user you want to invite.
- channel (object) – The channel you want to invite him to.
- network (object) – The network to execute the command on.
- fn (function) – The callback function to be called when the call has been finished.
Invites a user to a channel.
-
topic
(channel, topic, network, fn) Arguments: - channel (object) – The channel you want to set the topic in.
- topic (string) – The topic you want to set.
- network (object) – The network to execute the command on.
- fn (function) – The callback function to be called when the call has been finished.
Sets the topic of a channel.
-
join
(channels, keys, network, fn) Arguments: - channels (array) – The channels you want to join.
- keys (array) – The keys for the channels you want to join.
- network (object) – The network to execute the command on.
- fn (function) – The callback function to be called when the call has been finished.
Joins channels.
-
ircNames
(channel, network, fn)¶ Arguments: - channels (array) – The channel you want to get the nicknames from.
- network (object) – The network to execute the command on.
- fn (function) – The callback function to be called when the call has been finished.
Gets users from a channel.
-
ircMode
(target, flags, network, fn)¶ Arguments: - target (string) – Target for the mode change, can be a user or channel.
- flags (string) – Flags of the mode change.
- network (object) – The network to execute the command on.
- fn (function) – The callback function to be called when the call has been finished.
Sets modes.
-
ircKick
(channels, nicks, msg, network, fn)¶ Arguments: - channels (array) – The channels you want to kick from.
- nicks (array) – The nicks you want to kick.
- network (object) – The network to execute the command on.
- fn (function) – The callback function to be called when the call has been finished.
Kick user from a channel.
-
ircPart
(channels, msg, network, fn)¶ Arguments: - channels (array) – The channels you want to kick from.
- msg (string) – The part message.
- network (object) – The network to execute the command on.
- fn (function) – The callback function to be called when the call has been finished.
Parts channels.