Willie

Willie
Willie - Willie - The Python IRC Bot - http://willie.dftba.net/

Install
Dependencies: sudo yum install libxml2-devel libxslt-devel enchant sudo pip install feedparser pytz lxml praw pyenchant pygeoip sudo pip install IPython

Install Willie sudo pip install willie

Python 2.7 has a bug, to fix: sudo pip install backports.ssl_match_hostname
 * 1) error: ImportError: No module named backports.ssl_match_hostname

Execute
To run Willie, run as a non root user: $ willie

To fork (background): $ willie -f

Configure
To configure, run as a non root user, and answer the few questions: $ willie

This will create the config directory: ~/.willie/ ~/.willie/default.cfg

Note: when specifying a channel, make sure to prefix with "#"

~/.willie/default.cfg [core] nick = billybob host = myirc.server.com use_ssl = False port = 6667 owner = billyowner channels = #billybob,#somethingelse

admins = user1,user2 enable = echo,help,adminchannel,autoop

Usage
.help .commands .c 5 / 2

Modules
Note: multiple modules can be placed into the same file.

import willie
 * 1) ~/.willie/modules/helloworld.py

@willie.module.commands('helloworld') def helloworld(bot, trigger): bot.say('Hello, world!')
 * 1) .hello world

import willie
 * 1) ~/.willie/modules/echo.py

@willie.module.commands('echo') def echo(bot, trigger): bot.reply(trigger.group(2))
 * 1) .echo with arguments

import willie
 * 1) ~/.willie/modules/hi.py

@willie.module.rule('hello!?') def hi(bot, trigger): bot.say('Hi, ' + trigger.nick)
 * 1) regex

Core modules exist here: /opt/python-2.7.9/lib/python2.7/site-packages/willie/modules/

References:
 * Willie tutorial, Part 2 · embolalia/willie Wiki · GitHub - https://github.com/embolalia/willie/wiki/Willie-tutorial%2C-Part-2

Core Modules
Core modules exist here: /opt/python-2.7.9/lib/python2.7/site-packages/willie/modules/

adminchannel.py - op, deop, admin.py announce.py bugzilla.py calc.py chanlogs.py clock.py countdown.py currency.py dice.py etymology.py find.py find_updates.py github.py help.py - help, commands ip.py ipython.py isup.py lmgtfy.py meetbot.py movie.py ping.py radio.py rand.py reddit.py reload.py remind.py rss.py safety.py search.py seen.py spellcheck.py tell.py tld.py translate.py unicode_info.py units.py uptime.py url.py version.py weather.py wikipedia.py wiktionary.py xkcd.py youtube.py

admins can op themselves
Owner/Admins can op themselves --- adminchannel.py.old 2015-01-22 15:12:31.893968888 -0700 +++ adminchannel.py    2015-01-22 15:11:25.985975053 -0700 @@ -37,8 +37,12 @@    Command to op users in a room. If no nick is given, willie will op the nick who sent the command """ -   if bot.privileges[trigger.sender][trigger.nick] < OP: -        return +    #if bot.privileges[trigger.sender][trigger.nick] < OP: +    #    return +    if not (trigger.nick == bot.config.owner or +         trigger.nick in bot.config.admins.split(',') or +         bot.privileges[trigger.sender][trigger.nick] == OP): +             return     if bot.privileges[trigger.sender][bot.nick] < OP:         return bot.reply("I'm not a channel operator!")     nick = trigger.group(2)

auto op admins
import willie
 * 1) ~/.willie/modules/autoop.py

@willie.module.event('JOIN') @willie.module.rule('.*') def autoop(bot, trigger): nick = trigger.nick channel = trigger.sender if bot.privileges[channel][bot.nick] < willie.module.OP: return # not a channel operator! if (nick == bot.config.owner or       nick in bot.config.admins.split(',')): bot.say('Hi, ' + trigger.nick) bot.write(['MODE', channel, "+o", nick])