SiteMap Search ElispArea HowTo Glossary RecentChanges News Problems Suggestions

ErbotInstallation

Other sections:


Disclaimer: Please note that ErBot does not come in a nice packaged form for install yet. :). Nonetheless, if you want to install it and run it for some channels, here are step-by-step instructions that should be pretty easy. ErBot is most specially suited to lispy channels like #emacs and may not necessarily be suited for your needs. Have a look at the bot apt in #debian, and its package bobot++, to see if that suits you better– in fact, a lot of ErBot’s english interface is inspired from apt’s. Having said that, I think I like fsbot’s design and syntax more — allow the user a similar fuzzy english syntax that apt does, but that fuzzy syntax is just an interface to an accurate lisp syntax, which is also available to the user. Also, fsbot does a much smarter search-lookup, has tons of other features and is also a minor lisp interpreter.


IF YOU ARE UPGRADING YOUR BOT FROM A PREVIOUS, DON’T FORGET TO MAKE BACKUPS OF YOUR botbbdb, userfunctions.el, ETC. BEFORE RUNNING THE NEW VERSIONS. fledermaus has ensured proper encoding going forward, but you should probably check that your old botbbdb works well with the upgraded version.

Please let me know if there are any steps missing from here or anything is incomplete, and also feel free to edit anything in this page. – DeepakGoel

Basic Installation

The following are geared towards emacs newbies who are using debian. ~ refers to /home/mybot throughout this section.

X/Emacs versions: Erbot is developed on and for the stable debian emacs: (21.4.1 as of dec, 2005). It works on later emacsen, but some googling does not work on Emacs 22.1 ATM. SebastianFreundt has ensured that erbot works on xemacs too – 21.4 and 21.5

Place all these files in ~/elisp/.

Erbot can google. Want google?

Wiki Training

What good is an infobot unless it knows a few thousand pages. You can, of course, train it by talking to it, but wouldn’t you like that it automatically learn a few wikis? The good (bad?) thing about this automated training-through-IRC is that anyone can use this to train anyone’s bot through IRC. Thus, this section is currently a bit geared towards those somewhat familiar with elisp. If you are a bit lost by this section(shouldn’t be), catch hold of me or any lisp expert and ask them to use erbwiki.el to train your bot on a particular wiki.

In this section, ~ refers to your account, you being the person who is training someone’s bot on some channel, say on #somebot. Again, when you train the bot, you use your own Emacs as yourself, not the bot’s. Both you and the bot would be connected to irc, where you will (automatedly) train the bot.

 (defun erbwiki-connect-my ()
  (interactive)
  (unless (or (buffer-name-p-my "#somebot") erbwiki-connected-p-my)
    (setq erbwiki-connected-p-my t)
    (setq utils-erc-channels-list utils-erc-channels-list-train)
    (erc-select-noninteractive-my)))

Those intermediate functions for me are here:

 (setq utils-erc-channels-list-train
      '(("irc.freenode.net" 
         (
	  "#somebot"
	  ))))

 ;;;###autoload
 (defun buffer-name-p-my (name &optional matchfn)
  "Whether name is the name of a buffer.."
  (unless matchfn (setq matchfn 'string=))
  (member-if
   (lambda (arg)
     (funcall matchfn name 
	      (buffer-name arg)))
   (buffer-list)))
 ;;;###autoload
 (defun erc-select-noninteractive-my (&optional server port nick
					    user-full-name
					    not-connect-arg passwd)
  "Interactively run ERC, while trying to do a minimal prompting.
 Optional argument SERVER uses server as default for the input query.
 Optional argument PORT uses passed port as default for the input query.
 Optional argument NICK uses the passed nick as default for the input query."
  (interactive)
  (require 'erc)
  (if (and (null server) (listp erc-servers-my))
      (mapcar
       '(lambda (arg)
	  (erc-select-noninteractive-my
	   arg port nick user-full-name not-connect-arg passwd)
	  (sit-for 1)
	  )
       erc-servers-my)
    (progn
      (if (null server)
	  (setq server erc-server))
      ;; 2002-08-21 T11:22:35-0400 (Wednesday)    D. Goel
      (setq erc-current-server-my server)

      (if (null port) (setq port erc-port))
      (setq nick (erc-compute-nick nick))
      (let* (
	     (nick
	      (if (erc-already-logged-in server port nick)
		  (read-from-minibuffer
		   (erc-format-message 'nick-in-use ?n nick)
		   nick
		   nil nil 'erc-nick-history-list)
		nick)))
	(if (and passwd (string= "" passwd))
	    (setq passwd nil))
	(while (erc-already-logged-in server port nick)
	  (setq nick (read-from-minibuffer
		      (erc-format-message 'nick-in-use ?n nick)
		      nick
		      nil nil 'erc-nick-history-list)))
	(run-hook-with-args 'erc-before-connect server port nick)
	(erc
	 server port nick user-full-name (not not-connect-arg) passwd)))))

Alternate Method of Wiki Training

If you want a fairly simple method of wiki training, try the following instead (requires the url package which can be found in this debian package: apt-get install w3-url-e21):

      (require 'erburl)
      (erburl-scrape-terms
         "http://www.emacswiki.org/cgi-bin/wiki?action=index")

The above will load all of the terms from this wiki along with links back to the appropriate pages in very little time (compared to the previous training method). This call is asynchronous although you will not be able to do anything on the emacs console because it will be busy, but erbot will still be able to respond to user requests in a channel if connected.

It should be noted that this method of training does not remember what has been added (like the previous method); however, scraping the same page more than once will not add duplicate entries.

Finally, any URL can be scraped for data as you can pass your own parser to the above function. See the quickhelp in erburl.el and the docstring for erburl-scrape-terms.

Other Advanced Customization

erbot usually defines its functions to not conflict with existing lisp functions. Thus, the usual way to remove bot entries is RM and FORGET, but not REMOVE. The latter is a lisp function and gets passed to emacs’s own lisp for processing.

However, many people (esp. on nonlispy channels) don’t care much for elisp’s functions, and the first thing they try for removing entries is (remove). Mybot’s default .emacs makes that (remove) work through (erbunlisp-install).. That function takes special care of these rare “conflicts”. IOW, (erbunlisp-install) ensures that (remove) gets passed to ERBOT’s (fs-rm) function instead of lisp’s (remove). REMOVE is just an example, (erbunlisp-install) shall seek to usually take care of all similar issues.

More help

Start xchat (or how about an Emacs-based InternetRelayChat client?), go to #emacs (EmacsChannel) on the server irc.freenode.net (port 6667), and catch hold of deego or hroptatyr or any of fsbot’s other authors in #fsbot or the helpful folks in #emacs. Or send deego an email @gnufans.org.


ErBot