🟪sendMessage
The sendMessage method allows the bot to send a message to a specific IRC channel or user.
Syntax
bot.sendMessage(target, message, color);Parameters
target(string, required) – The channel (e.g.,#channelname) or username to send the message to.message(string, required) – The content of the message.color(string, optional) – The color of the message, based on the IRC Color Table.
Example Usage
Send a message to a channel:
bot.sendMessage('#YOUR-CHANNEL', 'Hello, IRC! MyBotNickname has joined.', 'red');Send a private message to a user:
bot.sendMessage('NICKNAME', 'Hello, IRC! MyBotNickname has joined.');Notes
Messages sent to a channel should begin with
#in thetargetparameter.Colors are optional and must follow the IRC Color Table.
If a
colorparameter is provided, it will override the defaultmessageColorset during connection.If no
coloris specified insendMessage, it will use themessageColorset inconnect.If neither
sendMessagenorconnectspecify a color, the default IRC color will be used.Ensure the bot has the necessary permissions to send messages in the channel.
Last updated