Menu

Tree [r1] /
 History

HTTPS access


File Date Author Commit
 plugins 2013-04-19 csxm [r1] Initial commit
 LICENSE.txt 2013-04-19 csxm [r1] Initial commit
 README.txt 2013-04-19 csxm [r1] Initial commit
 bot.py 2013-04-19 csxm [r1] Initial commit

Read Me

PyPluginBot
 by Ahti Komu (ahti.komu@gmail.com)

PyPluginBot needs:
- Python (http://www.python.org/) (obviously)
- Python IRC library (http://python-irclib.sourceforge.net/)

The idea of PyPluginBot is to provide an easy pythonic way to implement
commands into a ready made bot.

A new command (a plugin) is simply a python script in a folder
named [pluginname]_plugin with a name [pluginname_plugin.py
(and of course a package placeholder __init__.py)

Plugin should implement these variables:
_cmd = "command_name"
_help = "Help text which will be shown with Bot: help [pluginname]

and a method def execute(args, e, bot) which will be executed on _cmd
said to the bot:
- args is the list of arguments passed to the command
- e is the sender (or rather, event) of the command
- bot is the bot instance (used to access mainly reply method)

Plugin can do a threaded command with method:
do_thread_command(e, cmd, args) -> the command will receive e, bot, args

Mainly the commands that are usable from the bot instance are:
say_public(text)
say_private(nick, text)
reply(e, text) 
do_thread_command(e, cmd, args)

This should provide easy enough way to implement new commands into
the bot in a pythonic way in just minutes.

There are also example plugins in the plugins directory including a
simple travian plugin with very hard-coded variables.

A few fixed commands are coded into the bot:
- 'help [command]': says the _help of the command
- 'commands': says the list of commands
- 'hello': says the version of the bot
- 'reload_plugins': reloads the plugins (mainly meant for plugin programmer)

There are also a few variables that have to be set before starting the bot:
self.servers : a list of tuples of servers, eg. ('de.quakenet.org', 6667)
self.nick : nick of the bot
self.realname : realname for the bot
self.channel : channel for the bot to join on connection
self.password : password for the channel that the bot joins on connection

Bear in mind that the bot is still in quite an early stage and there
might be some things that cannot be done and it may be easy to break it.
Feel free to improve it!
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.