When you create a custom channel in Xenobot you pass the constructor three parameters: channelName, textCallback, closeCallback.
The first is a string and is the name given to the channel you create. The last is a function that is called when the channel is closed.
The second, which is relevant to what you're looking for, is called any time any text is sent in the channel. It looks something like this:
Code:
function OnSpeak(channel, message)
if (message == "ping") then
channel:SendOrangeMessage("Channel", "Pong!")
end
end
function OnClose() end --empty
local newChannel = Channel.New("Channel", OnSpeak, OnClose)
newChannel:SendOrangeMessage("Channel", "Hi!")