1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700
|
#LyX 1.3 created this file. For more info see http://www.lyx.org/
\lyxformat 221
\textclass report
\language english
\inputencoding latin1
\fontscheme default
\graphics default
\float_placement !htbp
\paperfontsize default
\spacing onehalf
\papersize a4paper
#\paperpackage a4wide
\use_geometry 0
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle fancy
\layout Title
Manderlbot, an erlang irc bot
\layout Author
Dimitri Fontaine
\layout Standard
\begin_inset LatexCommand \tableofcontents{}
\end_inset
\layout Chapter
Introduction
\layout Standard
This document provides some helpfull information (or I hope so) about the
manderlbot irc bot, on how to use and configure it.
\layout Section*
A bit of history
\layout Standard
But why did we wrote this software ?
\layout Standard
Well, I wanted an irc bot to play with, in order to have it say some silly
things automatically on answer to our own idioties.
I did not want an eggdrop or whatever controlling channel bot.
I saw that manderlbot
\begin_inset Foot
collapsed true
\layout Standard
You can see it on
\begin_inset LatexCommand \url[manderlbot SF page]{http://manderlbot.sourceforge.net}
\end_inset
\end_inset
project existing, was already familiar with erlang developpment, so I began
using it.
\layout Standard
The existing project was on early stage of development, and I wanted the
bot to do more and more things.
So I wrote some code to make it fit my needs.
As the original authors would not consider my patches, I forked the project,
keeping the name (they seemed not to work on their version at all), and
hosting it on the TuxFamily services
\begin_inset Foot
collapsed true
\layout Standard
Tuxfamily services are found here\SpecialChar ~
:
\begin_inset LatexCommand \url{http://tuxfamily.org}
\end_inset
\end_inset
.
\layout Chapter
Using manderlbot
\layout Standard
This is the user documentation of manderlbot.
\layout Section
Install
\layout Standard
The better would be to run a debian GNU/Linux system.
In that case, a simple
\family typewriter
apt-get install manderlbot
\family default
get you with all the necessary stuff.
\layout Standard
Otherwise, you'll have to get the last available manderlbot release on
\family typewriter
manderlbot.tuxfamily.org
\family default
, and the necessary tools, that is:
\layout Itemize
erlang system, see
\family typewriter
erlang.org
\family default
or your distribution vendor for some packages
\layout Itemize
\family typewriter
xmerl-0.15
\family default
library (which will allow for configuration file reading), available as
a user contribution on the
\family typewriter
erlang.org
\family default
web site.
\layout Standard
If you are using
\family typewriter
windows
\family default
, as erlang is known to work even on such a
\emph on
system
\emph default
, you should be abble to install and run
\family typewriter
manderlbot
\family default
.
But I did never try that, and do not plan to do it ever.
Good luck!
\layout Standard
\SpecialChar ~
\layout Standard
So you have installed erlang system and placed
\family typewriter
xmerl
\family default
library (version
\family typewriter
0.15
\family default
) at the right place (on my debian system, it is found in
\family typewriter
/usr/lib/erlang/lib/xmerl-0.15
\family default
).
You now can type the usual following:
\layout LyX-Code
$ make
\layout LyX-Code
$ sudo make install
\layout Standard
And manderlbot will be ready to be launched!
\layout Section
Launch and stop
\layout Standard
As of the 0.9.1 release of manderlbot, you can control manderlbot using the
given
\family typewriter
/usr/bin/manderlbot
\family default
script:
\layout LyX-Code
$ manderlbot
\layout LyX-Code
manderlbot start|stop|restart|status
\layout LyX-Code
$ manderlbot start
\layout Standard
The stop option will kill the running manderlbot, and if started the status
will list all the running bots, indicating the servers and channels where
it is connected.
\layout Standard
If you want to redirect outputs, you'll then prefer that way:
\layout LyX-Code
$ manderlbot start >/var/log/manderlbot.log 2>&1 &
\layout Standard
Please make sure you are allowed to write in your log file!
\layout Section
Configure
\layout Standard
The
\family typewriter
manderlbot
\family default
configuration file is to be found in
\family typewriter
/etc/manderlbot/config.xml
\family default
, and has to be edited to fit your needs.
By default it contains some basic rules as examples.
\layout Subsection
Configuration file
\layout Standard
The configuration file is an XML file containing the following elements:
\layout Description
manderlbot is the opening XML element of the configuration, and contains
the properties
\family typewriter
name
\family default
and
\family typewriter
controler
\family default
.
The name will be shown as the bot fullname, the controller property may
contain one or more nicknames separated by spaces, only those people will
then be allowed to operate on the running bot from irc channel.
\layout Quote
All the following sections, otherwise stated, are to be found under this
one.
\layout Description
dict is the section where to define the dictionnary server you may want
to use.
See
\family typewriter
dict.org
\family default
for details about the protocol and servers.
Be aware that you can run a dict server locally, and download some useful
dictionnaries.
\layout Quote
The properties to define here are the dict server
\family typewriter
host
\family default
, the
\family typewriter
port
\family default
, and the
\family typewriter
default
\family default
dictionnary to use.
\layout Description
server allows you to define which servers manderlbot should connect to.
The properties are
\family typewriter
host
\family default
and
\family typewriter
port
\family default
.
You have to define a server section for each and every irc server you want
\family typewriter
manderlbot
\family default
to connect to.
\layout Description
channel section is where to configure the
\family typewriter
manderlbot
\family default
behaviour and name.
This section has to be embedded in the server one.
You have to define a channel section per channel you want
\family typewriter
manderlbot
\family default
to join on a server.
\layout Quote
The properties of channel section are
\family typewriter
name
\family default
, the channel name,
\family typewriter
botname
\family default
, the manderlbot nickname on that channel, and
\family typewriter
behaviours
\family default
, a list of behaviours name you want to activate for that channel.
\layout Description
behaviours will just contain your behaviour list
\layout Description
behaviour have to be found under the
\family typewriter
behaviours
\family default
section.
You define here your behaviour, which properties are
\family typewriter
name
\family default
, the name to use in the channel definition, the
\family typewriter
action
\family default
, defining what will be done, and one or more of the followings pattern
elements:
\family typewriter
pattern
\family default
,
\family typewriter
op
\family default
,
\family typewriter
to, option
\family default
and
\family typewriter
from
\family default
.
You can even prefix those properties with '
\family typewriter
exl_
\family default
' to get an exclude pattern match (see section
\begin_inset LatexCommand \ref{sub:Behaviour-matching}
\end_inset
).
\layout Quote
This element contains data wich will be used as the
\emph on
action
\emph default
parameter, as explain in section
\begin_inset LatexCommand \ref{sub:Implemented-actions}
\end_inset
.
\layout Subsection
Behaviour matching
\begin_inset LatexCommand \label{sub:Behaviour-matching}
\end_inset
\layout Standard
So when you define a behaviour, you want
\family typewriter
manderlbot
\family default
to react on some event on irc channel it is connected to, and take some
action.
Here we see how to define the event you want it to react to.
As on irc all you do is sending lines of text, an event as to be text line
oriented.
\layout Standard
So
\family typewriter
manderlbot
\family default
configuration allows you to define some regexp
\begin_inset Foot
collapsed true
\layout Standard
Regular Expressions, see
\begin_inset LatexCommand \url{http://www.regular-expressions.info}
\end_inset
\end_inset
to match the lines received.
If the line is matched, the associated action is done.
Please note the regexp are all considered case insensitive ones.
\layout Standard
You can define some
\emph on
regexp
\emph default
on the following parts of the received line (containing some server information
s relative to IRC protocol
\begin_inset Foot
collapsed true
\layout Standard
See the
\begin_inset LatexCommand \url[RFC 1459]{http://www.faqs.org/rfcs/rfc1459.html}
\end_inset
\end_inset
):
\layout Description
pattern will try to match the user input, that is what your ordinary irc
client will show you
\layout Description
op will try to match the irc operation, see the RFC for complete list (op
can be
\begin_inset Quotes eld
\end_inset
kick
\begin_inset Quotes erd
\end_inset
or
\begin_inset Quotes eld
\end_inset
join
\begin_inset Quotes erd
\end_inset
for example)
\layout Description
to irc protocol
\family typewriter
to
\family default
field, will probably contain the channel name, so you won't need that...
\layout Description
option irc protocol
\family typewriter
option
\family default
field
\layout Description
from the nickname of the one who typed the current line, on the form
\family typewriter
nick!~user@host.domain.tld
\layout Standard
And in order to make it even more powerful and readable, you can define
the same patterns with an '
\family typewriter
exl_
\family default
' prefix, this will prevent the
\family typewriter
action
\family default
to being taken if it matches.
So you can define the parameters
\family typewriter
exl_pattern
\family default
,
\family typewriter
exl_op
\family default
,
\family typewriter
exl_to
\family default
,
\family typewriter
exl_option
\family default
and
\family typewriter
exl_from
\family default
.
\layout Standard
Of course, you can use any combination of the listed parameters, thus being
quite precise on what you want to react to.
\layout Subsection
Implemented actions
\begin_inset LatexCommand \label{sub:Implemented-actions}
\end_inset
\layout Standard
The
\family typewriter
action
\family default
parameter of the behaviour configuration element defines the manderlbot
behaviour on matching a line.
Here is a list of provided actions you can use.
If you want
\family typewriter
manderlbot
\family default
to take an action not described here, you will have to write some erlang
code to teach him what you want!
\layout Standard
The argument of the
\family typewriter
action
\family default
is the xml data given enclosed in the
\family typewriter
behaviour
\family default
element.
\layout Description
action send the given argument as if manderlbot had typed it after the
\family typewriter
/me
\family default
irc command.
\layout Description
answer send the line prefixed with the sender name and a colon.
\layout Description
bloto this will count the matched lines per user, and first obtaining 5
points has won the business loto game.
Just define your buzzwords set and make it a regexp!
\layout Description
debian_file will search the irc given file using the debian web site cgi.
The argument is not used.
\layout Description
debian_pkg will search the irc given package using the debian web site cgi.
The argument is not used.
\layout Description
dict will ask your defined dict server for the given word.
The argument may be the dictionnary name to use in the query, but defaults
to the '
\family typewriter
default
\family default
' entry of the dict config element.
\layout Description
google will ask google for the rest of the irc line.
The argument is not used.
\layout Description
mute will mute the bot, you have to be a controler to use that.
The argument is not used.
\layout Description
pyramid is a game named after a french TV game.
You have to make guess a world to an irc fellow on that channel, in a given
number or tries.
The argument is not used.
\layout Description
random will say one of the sentences listed in the arguments randomly.
The sentences have to be separated by '
\family typewriter
%
\family default
' signs.
\layout Description
reconf will ask the bot to re-read its configuration.
It allows you to handle dynamically your configuration, no need to restart
the bot, and irc control! You have to be in the controler list to use this
action.
\layout Description
rejoin allows you te rejoin a channel (useful on kick, just add a
\family typewriter
op=
\begin_inset Quotes erd
\end_inset
kick
\begin_inset Quotes erd
\end_inset
\family default
parameter to the behaviour element definition).
\layout Description
say will say the arguments.
\layout Description
timer will say the first argument, then wait for a random time, and say
the other arguments.
The args have to be separated bu a '
\family typewriter
%
\family default
' char.
\layout Section
Interacting with the running bot, from irc
\layout Standard
You can use the
\family typewriter
reconf
\family default
and
\family typewriter
mute
\family default
actions (see section
\begin_inset LatexCommand \ref{sub:Implemented-actions}
\end_inset
) to control the bot from irc, and you define who can do that in the first
configuration element, with the
\family typewriter
controler
\family default
property.
\layout Chapter
Conclusion
\layout Standard
You should now be abble to install, run and configure your manderlbot, and
have it play with you on your prefered IRC channel.
\layout Standard
If you miss some action, please consider playing with the code (in erlang)
or sending us some feature request, we may or may not implement your ideas!
\layout Standard
If you want to contribute, send a patch, and you may obtain a write access
on the CVS (you may want to create a user account on tuxfamily.org services
first).
\layout Standard
Enjoy manderlbot, enjoy free software!
\the_end
|