Skip to main content

OB - Framework to program bots

Project description

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 allow programming of own modules, providing your own commands alongside of the allready provided commands
OB has a “no-clause MIT license” that should be the most liberal license you can get at the year 2018.

to start an IRC bot use these options:

ob-irc -s localhost -c \#obbot -n obbot

use the –write options if you want to save your commandline options so starting the bot without providing them works.

to edit config options use the ed command:

ob ed config irc channel \#obbot

programming your own commands is easy, your can load your own module with the -m option a command is simple a function with one argument, the event the was generated on the bot.

def mycommand(event):

    <<< your code here >>>

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

HF coding and feedback is always welcome, just write to bthate@dds.nl

Bart

The OB package provides these programs:

ob             - object command line
ob-sh          - the OB shell
ob-daemon      - start the bot in a background proces
ob-do          - create a egg
ob-docs        - create documentation
ob-irc         - IRC bot
ob-rest        - REST server
ob-rss         - fetch and display feeds.
ob-sed         - sed program
ob-test        - test program
ob-udp         - used for udp to IRC channel relay

OB shell has the following commands:

begin
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

type the commands without an argument and you’ll be presented with a list options.

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. 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 on 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. decorators - decorators used in the rest of the program. 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. parse - parse code for the query language. rest - a REST server to share objects over HTTP. rss - feed pollers that can echo feeds to the IRC channel. 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.

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 9
Filename, size File type Python version Upload date Hashes
Filename, size ob-9.tar.gz (30.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page