Skip to main content

pure python3 library to program bots.

Project description

R E A D M E ###########

| OB is a pure python3 framework to program bots, provides an IRC bot to use and is extendible by programming your own commands. | OB uses a timestamped, type in filename, JSON stringified, files on filesystem backend and has timed based logging capabilities. | OB has been placed in the Public Domain and contains no copyright or LICENSE.

C O D E

.. autosummary:: :toctree: code :template: module.rst

ob				- OB base package.
ob.clock                    - timers
ob.cmds			- commands
ob.command                  - command parsing
ob.db			- db backend
ob.entry			- simple log/todo entry.
ob.errors	 		- exceptions
ob.event			- event class
ob.file			- file related functions.
ob.fleet                    - list of bots
ob.handler                  - event handler
ob.irc                      - irc bot
ob.loader                   - module loader
ob.log			- logging module
ob.shell			- shell related functions.
ob.tables			- use bin/tables to generate.
ob.tasks                    - threads
ob.term 			- terminal handling
ob.time			- time related functions.
ob.trace			- traceback related functions.
ob.types			- OB typing.
ob.url			- http related functions.
ob.user                     - manage users
ob.utils                    - utilities

I N S T A L L

if you need ZELF to have access to your local directory use this:

export PYTHONPATH="."

this will add your current directory to the pythonpath so the packages in it can be found by ZELF.

installation is through pypi:

sudo pip3 install ob

you can also run the bot from the tarball at pypi and run it directly or install with setup.py:

python3 setup.py install --user

running from the mercurial repository is also possible:

hg clone http://bitbucket.org/bthate/ob

lastely, you can also run directly from the tarball.

U S A G E

OB includes one program, the ob shell:

ob [-m mod1,mod2] command

to connect to irc use the -m irc option.

ob -m irc irc.freenode.net #dunkbots obbot

use the ed command to edit the last object with a certain type of OB objects:

ob ed cfg server==localhost server=irc.freenode.net

P R O G R A M M I N G

programming your own commands is easy, your can load modules with the -m option. if you create a mods directory and put your hello.py module in it, you would use:

ob -m mods

any command you have coded in hello.py would be available, see the show cmds command.

ob show cmds

a command is a function with one argument, the event that was generated on the bot.

example:

::

def mycmd(event): <your code here>

you can use event.reply() to send response back to the user:

::

def hello(event): event.reply("hello %s" % event.nick)

after starting ob with -m mods, you see the hello command added to the bot:

ob s cmds

ed,find,hello,ps,rm,show,stop,undel

H A V E F U N

enjoy the coding ! ;]

Bart

bthate@dds.nl | botfather #dunkbots irc.freenode.net | https://pypi.org/project/ob | http://bitbucket.org/bthate/ob

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ob, version 21
Filename, size File type Python version Upload date Hashes
Filename, size ob-21.tar.gz (20.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page