Using IRC Commands
Introduction
When on IRC, J-Alice can process the <irc:command>
tag, which makes the bot send a string directly to the irc
server.
Some things you can do with this is use the bot to send a
message to a person or channel, make it join or part channels,
and identify with nickserv, as well as many other things.
Example AIML Categories
<category>
<pattern>JOIN BOTS</pattern>
<template>
<irc:command>
JOIN #bots
</irc:command>
</template>
</category>
<category>
<pattern>JOIN *</pattern>
<template>
<irc:command>
JOIN <star/>
</irc:command>
</template>
</category>
<category>
<pattern>IDENTIFY WITH NICKSERV</pattern>
<template>
<irc:command>
PRIVMSG nickserv :identify botpassword
</irc:command>
</template>
</category>
OR
<category>
<pattern>IDENTIFY WITH NICKSERV</pattern>
<template>
<irc:command>
NICKSERV identify :botpassword
</irc:command>
</template>
</category>
The second one works with most IRC servers. The first one
won't work correctly with all networks, such as dal.net, where
nickserv is actually nickserv@services.dal.net.
However, the second form does work with dal.net. I recommend
using the second example, and only reverting to the first
if you have problems.
<category>
<pattern>MSG * *</pattern>
<template>
<irc:command>
PRIVMSG <star/> :<star index="2"/>
</irc:command>
</template>
</category>
<category>
<pattern>PART *</pattern>
<template>
<irc:command>
PART <star/>
</irc:command>
</template>
</category>
The Demons Lurking In Dark Corners
Some pitfalls to look out for. In the
substitutions.xml, there may be a substitution that replaces
the # character, making joining and parting a channel, and
messaging a channel fail. For join & part, an alternative
is to either remove the substitution, or put the # before
the <star/>. If you put the
# before the <star/>, then
when you ask it to join channel #foo,
you would omit the # character.
Other problems can also be due to substitution.
One that isn't, however, is sentence splitting. Currently
(changing soon), it splits at any and every period, question
mark, and exclaimation mark. So, for example, typing: join
#ut.raven will fail, as this will be treated as two
sentences. The first is "join #ut",
and the second is "raven", which
is completely different to what you would have wanted. For
channels like #ut.raven, you would
write a category similar to JOIN BOTS,
where the channel name is explicit, rather than a wildcard
value.
Conclusion & Final Tips
And that is about it. For other commands
you can't figure out, there is always the RFC 1459 document.
A bit technical though. Otherwise, just have a bit of an experiment.
The general forms are:
- <command>
<target> :<params>
- <command>
<single-param>
- <command>
:<params>
Where single-param is a parameter containing
no spaces, and params are parameters that may contain spaces.
All parameters that may contain spaces must be preceded by the
colon. So, with that, I hope you can figure out other IRC commands
that you may want or need.
In future, I'll be adding support to
use IRC client style commands, which will be a lot easier
for you to use, and be more familiar with. Until then, best
of luck with what you already have available to you.
|