-
Notifications
You must be signed in to change notification settings - Fork 170
Client Script Snippets
SongSing edited this page May 7, 2014
·
4 revisions
function say(message, channel)
{
if (channel === undefined)
{
channel = client.currentChannel();
}
client.network().sendChanMessage(channel, message);
}
Use this function to programmatically send messages. Be cautious in doing this, however, since you can go overactive! Not passing a channel
parameter will send the message to whatever channel's currently open.
Example(s): say("Wow!", channel);
say("Amazing!");
String.prototype.getMessage = function()
{
if (this.indexOf(":") !== -1)
return this.substr(this.indexOf(":") + 2);
return this;
};
This can be used to get the actual message from the channelMessage
event.
Example(s): var msg = message.getMessage();
String.prototype.getUser = function()
{
return this.split(':')[0]; // users can't have colons in names
};
Gets the username from the channelMessage
event.
Example(s): var user = message.getUser();