The QML bot example is a simplified version of the bot example, written in QML. See the QML compatibility article for more QML specific details.
The following snippet illustrates how IrcConnection is prepared and opened, and how a command is queued to automatically join a channel when connected.
The example utilizes IrcCommandParser for parsing commands from messages received from other clients. In order to take the parser in use, the supported commands must be teached, as illustrated below. Some of the commands are context sensitive, and the parser must be therefore kept aware of the list of channels the bot is on. This is easily achieved by binding the IrcCommandParser::channels property to the value of the IrcBufferModel::channels property. Furthermore, like a typical IRC bot, the commands are triggered using a slightly different syntax in queries and channels.
The bot listens to incoming messages via IrcConnection::messageReceived(). The current target is chosen based on whether the incoming message is a channel or a private message. Each message content is parsed for commands that were taught earlier.
Files: