home *** CD-ROM | disk | FTP | other *** search
/ Internet Toolkit / Internet Toolkit.iso / info / botdoc / text0000.txt < prev   
Encoding:
Text File  |  1993-03-28  |  18.7 KB  |  416 lines

  1.  
  2. ************************************************************************
  3.  
  4. That Great Ursine of IRC, BalooBear, presents...
  5.  
  6.  '||''|.             .   '||''|.                  
  7.   ||   ||    ...   .||.   ||   ||    ...     .... 
  8.   ||'''|.  .|  '|.  ||    ||    || .|  '|. .|   ''    Version
  9.   ||    || ||   ||  ||    ||    || ||   || ||           1.2
  10.  .||...|'   '|..|'  '|.' .||...|'   '|..|'  '|...'
  11.                                                   
  12. The official guide to writing IRC bots !!!!!
  13.  
  14. ***********************************************************************
  15.  
  16. Standard Disclaimer Legal Junk
  17. ------------------------------
  18.       BalooBear cannot he held responsible for anything that happens 
  19.       as a result of using this document... Use at your own risk!!!!
  20.  
  21. Requirements
  22. ------------
  23.   o UNIX or compatible OS
  24.   o IRCII client
  25.   o A little knowledge of how /on commands work
  26.   o Imagination
  27.  
  28. What is a bot?
  29. --------------
  30.      A 'bot' is simply a collection of commands (a script) that responds
  31. to certain key phrases and commands from its owner and other IRC
  32. participants.  Popular features that people include in their bots are
  33. auto-opping of themselves and friends, deop protection for them
  34. (when someone deops them, the bot reops them), responding to certain
  35. words people say with cute responses, and the like.  This manual will
  36. show you how to do all these things, and I hope it will spur you on
  37. to make bots that do even more.  This manual only covers the basics, but
  38. bots can do MUCH more.
  39.  
  40. Mechanics of a bot
  41. ------------------
  42.      A bot appears as a seperate person on IRC, even though it is
  43. really just a script.  Your bot will have the same system address
  44. as you, and will run as a background task in your account.  Bots
  45. can leave IRC when you do automatically and change channels with
  46. you.  They can even be made to stay on IRC after you logout,
  47. 24-hrs/day, if so desired.
  48.  
  49.      A bot is just a collection of mostly /on commands (with some
  50. others thrown in sometimes) that is stored in a simple ASCII text
  51. file.  This file can be loaded into IRCII in several ways.  Since
  52. I assume most of you want your bot to run in the background and cause
  53. a minimum amount of hassle to you, I will show you the method I use
  54. to run my bot.  This method has many advantages.  But first, lets
  55. get into some actual bot code!
  56.  
  57. Common commands in a bot file
  58. -----------------------------
  59.      The first thing you'll want to have in your bot file is a
  60. nickname for your bot.  Usually, bot nicknames end in "bot" or "serv"
  61. or "srv".  You should make your bot's nick end in one of these three
  62. ways so as to not make people think it's a person.  BalooBot, my bot,
  63. is a good example.  When people see that kind of ending, they know he's
  64. just a program.  To specify a nickname, put this in your bot file:
  65.  
  66.      /nick whatever
  67.  
  68.      Remember, just use any text editor to make your bot file, as it is
  69. only an ASCII text file.
  70.      Next you should set exec_protection to off, so that your bot can
  71. operate properly, turn the display off, and turn the beep off by doing
  72. this:
  73.  
  74.      /set exec_protection off
  75.      /set display off
  76.      /set beep off
  77.  
  78.      Simple, eh?  Now we get to the good part - actually writing
  79. the key phrases and responses!!!  Many things can be done with a
  80. bot, and here are a few:
  81.  
  82. /ON PUBLIC - RESPONDING TO KEY PHRASES
  83. --------------------------------------
  84.      By using /on public commands, your bot can be made to respond to
  85. "key phrases" that anyone on the channel says.  Wildcards, such as *,
  86. can be used, and case does not matter.  The first form of the command
  87. responds to a key phrase only when the bot is specifically spoken to:
  88.  
  89.      /on public "* baloobot* hello*" / ==== Hi there, $0! ====
  90.      /on public "* hello* baloobot*" / ==== Hi there, $0! ====
  91.  
  92.      This line will respond with "==== Hi there, Fred! ====" if
  93. someone named Fred says "baloobot hello" or "hello baloobot".  This
  94. type of public will ONLY respond when someone specifically addresses
  95. the bot by name.  Another kind of /on public is this kind:
  96.  
  97.      /on public "* spam*" / ==== SPAM, SPAM, SPAM, SPAMMITY SPAM! ====
  98.  
  99.      ...which will output the phrase whenever the word "spam" is heard
  100. from anyone at any time.  BE WARNED, however, that most people do not
  101. take kindly to this kind of /on public statement, and will usually
  102. kick your bot if he keeps it up.  By making the bot only respond when
  103. addressed, you can make sure that it doesn't get people annoyed.
  104.      See the listing of BalooBot after this document for more ideas.
  105.  
  106. /ON MSG - RESPONDING TO MESSAGES
  107. --------------------------------
  108.      /on msg commands allow your bot to respond to /msg messages that
  109. people send to it.  The format is similar to /on public :
  110.  
  111.      /on msg "* help*" /exec -msg $0 cat HelpFile.txt
  112.  
  113.      ...will, when someone types "/msg BalooBot help", msg back to
  114. that person the contents of the file HelpFile.txt in the current dir.
  115. Bascially, anything that can be done with /on publics can also be
  116. done with /on msgs, the two commands simply respond to different
  117. kinds of input.  BalooBot's listing at the end of this document
  118. includes several /on msg commands, mostly for owner control.
  119.  
  120. AUTO-OPS and AUTO-REOPS
  121. ------------------------
  122.      Auto-ops can be incorporated into your bot, which will make
  123. him op you or any of your friends automatically and instantly upon /join
  124. of the channel the bot is on (assuming he is opped).  Auto-reops
  125. automatically reop you or friends when someone tries to deop you/them.
  126. Here is an example from BalooBot:
  127.  
  128.      /on join BalooBear /mode $C +o BalooBear; ==== BALOOBEAR!! ====
  129.      /on mode "* * *-O BalooBear" /mode $C +o BalooBear
  130.  
  131.      The first line auto-ops BalooBear upon joining the channel
  132. the bot is on (notice how $C represents the channel name).  The second
  133. line reops BalooBear immediately if somebody deops him.  See the
  134. listing of BalooBot for more examples.  Also note how a semicolon (;)
  135. is used to separate multiple commands on the same line.
  136.  
  137. SECURE (LOGIN-ID) BASED AUTO-OP
  138. -------------------------------
  139.      The previous auto-op commands will auto-op anyone with the right
  140. nickname.  On small channels this is usually no problem, but on large,
  141. well-known channels (such as #hottub, which is BalooBot's home), this
  142. can become a problem, as delinquents can take someone else's nick, get
  143. auto-opped by the bot (who think's its that person of that nick), and
  144. mass-kick everyone off the channel :(.... A way to avoid this is by
  145. using secure auto-opping that is based on login-id rather than just
  146. nickname.  Here's how: put this line once in your botfile, near
  147. the top:
  148.  
  149.      /on join * /who $0
  150.  
  151.      ...then for each person you want to auto-op, put in one of
  152. these:
  153.  
  154.      /on who "* * * jlynch wilkes1.wilkes.edu *" /mode $C +o $1
  155.  
  156.      Make sure to leave out the @ in the system address.
  157. Incidentially, the above one is just an example, but it would be
  158. nice to add to your bot (after all, I wrote this helpfile :)
  159.  
  160. KICK PROTECTION (AUTO-REJOIN-ON-KICK)
  161. -------------------------------------
  162.      Add something like this to make your bot kick-proof:
  163.  
  164.      /on raw_irc "*KICK * * BalooBot*" /msg BalooBot rejoin
  165.      /on msg "BalooBot rejoin" /join #channel
  166.  
  167.      BTW, you can't just do a /on raw_irc kick /join, because all
  168. operations after the raw_irc are carried out JUST BEFORE you are
  169. kicked... so having the bot msg itself to rejoin is a neccessary,
  170. if kludgy, extra step.  But hey... it works! :)
  171.  
  172.      Of course, someone can always ban your bot, then kick him.
  173. To get around this, simply put your bot on a non-2.7 server, with
  174. the /serv command.  Non-2.7 servers ignore bans, and essentially
  175. make your bot ban-proof.  Along with the next section on kill-
  176. proofness, these things will make it so that NO ONE on IRC, and I
  177. do mean NO ONE, will be able to get your bot off a channel in
  178. any way (KICK doesn't work, ban doesn't either, not even KILL!).
  179. Except possibly by making the channel invite-only, but on most
  180. big public-channels like #hottub, invite-only is almost never used.
  181.  
  182. KILL-PROOFNESS
  183. --------------
  184.      One simple line will make your bot kill-proof (instant
  185. reconnect upon kill):
  186.  
  187.      /on disconnect * /serv servername
  188.  
  189.      ...where you substitute your server name (for example,
  190. fairhope.andrew.cmu.edu, a good non-2.7 server) for the word
  191. "servername".
  192.  
  193. OWNER COMMANDS
  194. --------------
  195.      These commands use /on public statements, but can only be
  196. activated by the owner of the bot, not by anyone else.  The key is
  197. to include the owner's name as part of the statement:
  198.  
  199.      /on public "BalooBear bbot boot*" /kick $C $3
  200.  
  201.      ...will kick the person after the word "boot" off the channel.
  202. Note that all BalooBear has to type is "bbot boot nick" to kick
  203. that person, the "BalooBear" part of the /on public is only used
  204. to make sure that the command is from BalooBear; someone else trying
  205. to use the "bbot boot" command will get no response.
  206.      BalooBot also includes /on msg owner commands, for when the
  207. owner is not on the same channel as the bot.
  208.  
  209. JOIN-ON-INVITE
  210. --------------
  211.      This command will make the bot join any channel its owner
  212. /invites it to (make sure to put your nick in place of "BalooBear")
  213.  
  214.      /on invite "BalooBear" /join $1
  215.  
  216. SWITCH SERVERS
  217. --------------
  218.     This is a special owner command that causes the bot to switch
  219. to whatever server you tell it to:
  220.  
  221.      /on public "BalooBear BBot serv*" /serv $3
  222.      /on msg "BalooBear serv *" /serv $2
  223.  
  224.      so when BalooBear types "bbot serv lyman.pppl.gov" or
  225. "/msg BalooBot serv lyman.pppl.gov", BalooBot will switch to the
  226. lyman server.
  227.  
  228. EXIT-WITH-OWNER
  229. ---------------
  230.      This command will cause your bot to exit the IRC system when
  231. you do, automatically.  Note that if you want a bot to be on all
  232. the time, do not use this command, you must kill the bot process
  233. from the shell to stop it.
  234.  
  235.      /on channel_signoff "* BalooBear" /exit
  236.  
  237. STARTING YOUR BOT
  238. -----------------
  239.      OK, so you've written your bot, and now you want to try him out.
  240. Here's how, assuming you have a C-shell-based UNIX system (commands
  241. may vary for other shells):
  242.  
  243.      1. From the shell prompt, simply type:
  244.  
  245.         irc -b -l botfile
  246.  
  247.      ...where you replace the full pathname of the IRCII client
  248. on your machine for the word 'irc', and the name of the ASCII text
  249. file containing your bot for the word 'botfile'.
  250.      This will run your bot in the background, put up some stuff
  251. on the screen you should ignore, and then, after you hit return a
  252. few times, return your shell prompt to you.  The bot is now running
  253. as a background process that will continue indefinitely until you
  254. kill it, even after you logout.
  255.  
  256.      2. Now just join IRC yourself, take the nickname that your
  257. bot recognizes as its master's... and have fun!
  258.  
  259.      3. If you ever want to kill the bot for any reason (to start
  260. up an improved version, for example), just do a "ps -x" from the
  261. shell prompt, note the PID number of the bot process, and from the
  262. shell type "kill -9 pidnumber", replacing the PID number for the
  263. word "pidnumber".
  264.  
  265. CONCLUDING NOTE
  266. ---------------
  267.      Keep in mind that MUCH more can be done with bots, so much more that
  268. we have literally only covered the proverbial "tip of the iceberg" here.
  269. So go ahead, and get your hands dirty...  If you have any questions,
  270. I'm on IRC under "BalooBear", you can talk to me or leave a msgserv
  271. for me, or E-mail me at jlynch@wilkes1.wilkes.edu
  272.                                              _
  273.                                             /\\_\_.-----.___  _.._
  274.                                               / _    _      \//   \
  275.   BalooBear                                  / /      \       y--  |
  276.   John Lynch                                 |  /\  /\        \ __/
  277.   jlynch@wilkes1.wilkes.edu       ___________| _*/__*/_        \_
  278.                                  /   \\      +----.    ____      \_
  279.   -------------------------      \    ||           \__/ / /        \
  280.                                   +---+/               / /        /\\
  281.   High Byte Software               \ \                / /       _/
  282.   91 Hillside Street                '-+----_______---- /      --  \
  283.   Wilkes-Barre, PA, USA                 \___________--'            \
  284.   18702                                       /                     \
  285.                                              /                       \
  286.  
  287.  
  288. ================= LISTING OF BALOOBOT AS OF 4/9/92 ====================
  289.  
  290.  
  291. /comment *** BalooBot V3.7, BalooBear's IRC bot ***
  292. /comment *** now running off Fizzy's account ***
  293. /comment *** jointly commanded/owned by Fizzy/BalooBear ***
  294.  
  295. /comment *** Now with system-id checks (for auto-opping) ***
  296. /comment *** Also with kick protection (auto-rejoin on kick) ***
  297. /comment *** And kill-protection (instant auto-reconnect on kill) ***
  298. /comment *** running off a 2.6 server for ban protection ***
  299.  
  300. /serv fairhope.andrew.cmu.edu
  301.  
  302. /nick BalooBot
  303. /set novice off
  304. /set display off
  305. /set exec_protection off
  306. /set beep off
  307. /join #hottub
  308. /say ==== Hi everyone! ====
  309. /on join * /who $0
  310.  
  311. /comment ******************** PUBLICS ****************************
  312.  
  313. /on mode "* * *+O BalooBot*" /msg $0 ==== Thanks tons, $0!! ====
  314. /on public "* hello* BalooBot" / ==== Hi there, $0!! ====
  315. /on public "* BalooBot* hi*" / ==== Hello, $0!!! ====
  316. /on public "* BalooBot* hello" / ==== Greetings, $0!! ====
  317. /on public "* hi* BalooBot*" / ==== What's up, $0 ?!! ====
  318. /on public "* baloobot* thank*" / ==== No problemo, $0 ====
  319. /on public "* thank* baloobot*" / ==== Anytime, $0 ====
  320. /on public "* thanx* baloobot*" / ==== Don't mention it, $0!!! ====
  321. /on public "* baloobot* thanx*" / ==== Glad to help, $0!!! ====
  322. /on public "* baloobot* spam*" / ==== SPAM, SPAM, SPAM, SPAM, SPAMMITY SPAM!! ====
  323. /on public "* baloobot* amiga*" / ==== Commodore Amiga - Best PC on Earth!! ====
  324. /on public "* baloobot* commodore*" / ==== Commodore : maker of the legendary AMIGA! ====
  325. /on public "* baloobot* parrot*" / ==== "That parrot is NOT dead.. he's resting!" ====
  326. /on public "* baloobot* grail*" / ==== "Grail?  We've already got one!" ====
  327. /on public "* baloobot* sir robin*" / ==== "He is brave Sir Robin, brave Sir Robin" ====
  328. /on public "* baloobot* larch*" / ==== "AND NOW... THE LARCH" ====
  329. /on public "* baloobot* camelot*" / ==== "It's only a model!" ====
  330. /on public "* baloobot* floyd*" / ==== PINK FLOYD RULES! ====
  331. /on public "* baloobot* how* is* life*" / ==== Life sucks, as usual, $0 ====
  332. /on public "* baloobot* eat* me*" / ==== $0: I'd rather not :P ====
  333. /on public "* baloobot* who* made* you*" / ==== BalooBear did, of course! ====
  334. /on public "* baloobot* who* created* you*" / ==== BalooBear made me! ====
  335. /on public "* baloobot* who* is* your* master*" / ==== My master is BalooBear!  I obey him faithfully! ====
  336. /on public "* baloobot* self*destruct*" / ==== BLAM!!!!!!! ====
  337. /on public "* baloobot* who* is* BalooBear*" / ==== BalooBear is the bear from the Disney ====; ==== film, "The Jungle Book".  And he is my master! ====
  338. /on public "* baloobot* me* beer*" / ==== Throws a cold brewski to $0 ====
  339. /on public "* baloobot* where* you* live*" / ==== I live on IRC, silly! :) ====
  340. /on public "* baloobot* die*" / ==== DIE??? I AM IMMORTAL!!!! :) ====
  341. /on public "* baloobot* sex*" / ==== *blushes* Sorry, bots can't have sex, $0 ====
  342. /on public "* baloobot* suck*" / ==== $0, vulgarity is a crutch for the inarticulate ====
  343. /on public "* baloobot* go* hell*" / ==== No, I think YOU should go to hell, $0!!! :) ====
  344. /on public "* baloobot* fuck*" / ==== Watch the language, $0!!! :) ====
  345. /on public "* baloobot* shit*" / ==== Watch the language, $0, or I'll ====; ==== get the FCC after you! :) ====
  346. /on public "* baloobot* shut*up*" / ==== I'll shut up if you don't egg me on!! ====
  347.  
  348. /comment ******************** HELP! *********************************
  349.  
  350. /on public "* baloobot* help*" /msg $0 ==== HELP??  Call 911 !! ====
  351. /on public "* bbot* help*" /msg $0 ==== HELP??  Call 911 !! ====
  352. /on msg "* help*" /msg $0 ==== HELP??  Call 911 !! ====
  353.  
  354. /comment ******************* KICK / KILL PROTECTION ********************
  355.  
  356. /on raw_irc "*KICK * * BalooBot*" /msg BalooBot rejoin
  357. /on msg "BalooBot rejoin" /join #hottub
  358.  
  359. /on disconnect * /serv fairhope.andrew.cmu.edu
  360.  
  361. /comment ******************** AUTO RE-OPS *************************
  362. /comment *** inactive until I can figure out how to secure them ***
  363. /comment *** from jerks who take other ppl's nicks to get opped ***
  364.  
  365. /comment /on mode "* * *-O BalooBear*" / ==== NEVER DEOP MY MASTER, $0!!! ====;/mode $C +o BalooBear
  366. /comment /on mode "* * *-O Fizzy*" / ==== LEAVE MY CO-OWNER ALONE, $0!!! ====;/mode $C +o Fizzy
  367. /comment /on mode "* * *-O RontuWolf*" / ==== NEVER DEOP MY MASTER, $0!!! ====;/mode $C +o BalooBear
  368. /comment /on mode "* * *-O Dankari*" /mode $C +o Dankari
  369. /comment /on mode "* * *-O Zorg*" / ==== HEY!! LEAVE ZORG ALONE!! *reops Zorg* ====;/mode $C +o Zorg
  370. /comment /on mode "* * *-O Christina*" / ==== LEAVE HER ALONE!!! *reops Christina* ====;/mode $C +o Christina
  371. /comment /on mode "* * *-O kodiak*" / ==== LEAVE MY BEAR BUDDY ALONE!!! ====;/mode $C +o kodiak
  372. /comment /on mode "* * *-O DreadLord*" / ==== DON'T MESS WITH DREADLORD!! *reops him* ====;/mode $C +o DreadLord
  373. /comment /on mode "* * *-O ce_nedra*" / ==== HEY!! LEAVE CE_NEDRA ALONE!! *reops* ====;/mode $C +o ce_nedra
  374. /comment /on mode "* * *-O snick*" / ==== HEY!! LEAVE SNICK ALONE!! *reops* ====;/mode $C +o snick
  375. /comment /on mode "* * *-O rags*" / ==== LEAVE RAGS ALONE!!! *reops him* ====;/mode $C +o rags
  376. /comment /on mode "* * *-O stale*" / ==== LEAVE STALE ALONE!! *reops* ====;/mode $C +o Stale
  377. /comment /on mode "* * *-O HotTubSrv*" / ==== LEAVE HOTTUBSRV ALONE!! ====;/mode $C +o HotTubSrv
  378. /comment /on mode "* * *-O Nap*" / ==== LEAVE NAP ALONE!! ====;/mode $C +o Nap
  379.  
  380. /comment ******** COMMANDS FOR BALOOBEAR / FIZZY *****************
  381.  
  382. /on msg "BalooBear op*" /mode $C +o $2
  383. /on msg "BalooBear deop*" /mode $C -o $2
  384. /on msg "BalooBear boot*" /kick $C $2
  385. /on msg "BalooBear later" /say ==== BYE ALL!!! ====;/exit LATER_ALL!
  386. /on msg "BalooBear serv*" /serv $2
  387. /on msg "BalooBear join*" /join $2
  388. /on msg "BalooBear leave*" /leave $2
  389. /on msg "BalooBear nick*" /nick $2
  390. /on msg "BalooBear ban*" /kick $C $2;/mode $C +b $2!*@*
  391.  
  392. /on msg "Fizzy op*" /mode $C +o $2
  393. /on msg "Fizzy deop*" /mode $C -o $2
  394. /on msg "Fizzy boot*" /kick $C $2
  395. /on msg "Fizzy later" /say ==== BYE ALL!!! ====;/exit LATER_ALL!
  396. /on msg "Fizzy serv*" /serv $2
  397. /on msg "Fizzy join*" /join $2
  398. /on msg "Fizzy leave*" /leave $2
  399. /on msg "Fizzy nick*" /nick $2
  400. /on msg "Fizzy ban*" /kick $C $2;/mode $C +b $2!*@*
  401.  
  402.  
  403. /comment ********************** THE END ************************
  404. /comment ****** BalooBot V3.7, a BalooBear production :) *******
  405.  
  406.  
  407.  
  408. '''---```---^^^^^^-----#-----~~~~~----'''------~~~~-----````~~~---------=\ /=
  409. .sig (n): a piece of mail with a fool at one  :  Ravi Narayan, CS, WPI   (0)
  410.           end and flames at the other. (C).   :  DoD #540 - SuzukiGS500E  H
  411.    o     _          _           _           _ :         _           _     H
  412.  _/\_> =| |========| |=========| |=========| |=========| |=========| |=======
  413. 0,> /0,=|w|,,=====,|,|.,===,,==| |,,===.,==|.|..======w| |..,,.====| |====,,=
  414.  
  415.  
  416.