pure python3 library to program bots.
OB is pure python3 framework you can use if you want to program bots. It uses JSON as the storage backend and provides persistence in timestamped files. OB allows programming of own modules, commands, callbacks, db backends, own classes, etc.
OB has a "no-clause MIT license" that should be the most liberal license you can get at the year 2018.
source code is available with:
hg clone http://bitbucket.org/bthate/ob
OB is on pypi, see https://pypi.org/project/ob/
you can install it with:
pip3 install ob
the OB package provides these programs:
ob - the OB program. ob-do - create a distribution. ob-docs - create documentation ob-sed - sed program ob-test - test program
to start an IRC bot use these options:
ob -i irc -c localhost -j #obbot -n obbot
see --help for options that can be used.
to edit config options use the ed command:
ob ed ob.irc.Cfg channel #obbot ok channel="#obbot"
OB shell has the following commands:
begin - start a egg timer. cfg - show config files. cmds - show list of commands. correspondence - show email conversations. deleted - show deleted records. ed - edit saved json objects. end - stop the timer, show elapsed time. exit - stop the program. fetcher - collect rss feeds. find - find objects in the datastore. fleet - show list of registered bots. friday - set todo item for friday. holiday - set todo item for the holidays. house - remember things todo around the house. kill - stop a thread. last - show last record of a object type. load - load a module. log - log some text. ls - list subdirectories in the workdir. mbox - scan a mbox/maildir and convert items to OB objects. meet - add a user monday - log a todo item on monday perm - change permissions of a user. ps - show running threads. quit - quit the IRC server. reboot - reboot the bot. rm - set the deleted flag on an object. rmperm - remove permissions. rss - add a RSS feed's url. saturday - log todo for saturday. shop - add to shopping list. sunday - sunday's todo list. test - echo test response. todo - store a todo item. timer - echo text on a certain time. thursday - thursday events. tuesday - tuesday's things todo. unload - unload a module. uptime - show uptime. user - user lookup. version - show OB version. wednesday - thing todo on a wednesday
Programming your own commands is easy, your can load your own module with the -m option. A command is a function with one argument, the event that was generated on the bot.
<<< your code here >>>
You can use event.reply() to send response back to the user.
The following modules can be loaded from the ob package space:
ob - the ob package containing the Object class providing load/save to JSON functionality. anytpe - contain any type constructable. bot - bot module for the Bot class, contains the basic Bot to inherit from. cli - the command line interface bot giving access to the bot from the shell. clock - time, clock and repeater functions and classes. cmds - commands subpackage containing the above listed commands. db - database functionality that can search through objects stored on disk. dcc - direct chat to chat bot. email - email scanning and analysing. entry - enter logs, todoos and shop items etc. event - the Event class generated on bots when data is read from the socket. fleet - list of registered bots managed in the Fleet class. handler - the event handler of the bot. init - start/stop scripts. irc - IRC bot. loader - Loader class to load modules from ob space into the program. obj - the "dotted access dict" class allowing attribute access to dicts. rest - a REST server to share objects over HTTP. rss - feed pollers that can echo feeds to the IRC channel (needs feedparser). shell - shell related startup, cli arguments parsing and logging. test - test code. thr - thread module to launch, kill threads. trace - get tracedumps in a single string format. udp - udp to IRC channel server, tail -f your log files to a channel. users - user management module. utils - utility sub pakcage. xmpp - contains the XMPP bot (needs sleekxmpp)
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size ob-20.tar.gz (22.7 kB)||File type Source||Python version None||Upload date||Hashes View|