IrcBot

Some Python IRC bot bits:

CommunityWiki:TheBot - a meta-bot that calls other existing bots... actually that's just an idea not working code.


Jul'2014 - play with Willie

for 2014-07-06-AiAssistedCoaching

Setup Willie

  • need to go into st VirtualEnv to have pip work with python2.7
  • then pip install willie works
  • find that willie is installed inside st/bin/willie
  • from inside /st/ type willie to launch - get error No module named backports.ssl_match_hostname which had been warned about.
  • do pip install backports.ssl_match_hostname then launch Willie again and it works!
  • name bot Wilson
  • hmm defaults to irc.dftba.net - ok let's try that!
  • which channels? #test,#tech,#YourPants
  • db - sqlite - wilson_dftba.db
  • modules to config - error loading everything.
  • but it connected to the server anyway
  • using DFTBA server seems odd, so decide to try with FreeNode
  • but that's raising issues with Nick Serv....
  • Ignoring NickServ issue for the moment, as bot shows up as a guest ID.

Jul10: Create helloworld.py in modules subdirectory. Test, it works!

After NickServ, will ponder modules that aren't installed (ah, found core set of modules) (and a set of extras)

Error loading ip: No module named pygeoip (modules/ip.py:13)
Error loading currency: No module named lxml (modules/currency.py:11)
Error loading weather: No module named feedparser (modules/weather.py:15)
Error loading spellcheck: No module named enchant (modules/spellcheck.py:13)
Error in chanlogs setup procedure: Configuration Error: Channel logs are not configured (modules/chanlogs.py:80)
Error loading reddit-info: No module named praw (modules/reddit-info.py:13)
Error loading ipython: No module named IPython.frontend.terminal.embed (modules/ipython.py:23)
Error loading rss: No module named feedparser (modules/rss.py:16)
Error loading bugzilla: No module named lxml (modules/bugzilla.py:11)

Modify config file to add core.extra param so my bot code can be off in its own directory. Stick a helloextra.py copy in there, so I can confirm it works.

Hrm seem to be having connection issues, suspect it's related to that Nick Serv thing. Read a bunch, get confused, fail to register, etc. Conclude that error came from being set to a nickname that's already in use. So use wilson_flux. Now connecting quickly without complaint. And both .helloworld and .helloextra work fine.

Jul11: creating simple module that uses regex wildcard rule to catch every line. Doesn't seem to be working. Also, for logistics hassles, need to

  • settle how module reloading works (so don't have to quit app to reload)
  • maybe run local IRC server so don't have to worry about HotSpot-s that block non-standard ports....

IRC server

  • try InspIRCd
  • consider UnrealIRCd - don't see anything current about Mac-specific installs available
  • fall back to miniircd - Python!
    • runs fine, both Colloquy and willie connect to it fine!

Getting reload to work?

  • copy reload.py code to my modules directory
  • now if I send privmsg to willie with .reload it works

Wildcard regex rule working?

  • Yes, for my simple case.
  • But not for StaticBot.py (which David Ross wrote to work with Twisted Matrix? Or was it Eric Florenzano?)
    • ah, problem is path to files...
    • aha, by moving my location down inside /wilson/ before launching willie, the path got corrected!
    • but still not working...
    • aha, I think issue is that function was named privmsg() which is already used/reserved...

So StaticBot.py is working, but 90% of the time its output is a two-word sentence.

Before digging back into that content-code, I'm going to create a better Self Improvement corpus to feed it with, so at least I have a better smell-test for if I'm heading in the right direction....

Replace that file as the corpus. Now getting real sentences as output. (Maybe the previous corpus wasn't long enough, so there weren't enough words to chain?)

Jul17: download Python ELIZA code. It works via Command Line.

Just comparing those two sets of interactions. Neither is satisfactory, but not sure how I'd mush them together. Not sure what I'm looking for...

Nov'2017 idea: Inside-Out Markov Chain!


Edited:    |       |    Search Twitter for discussion