Welcome to OB, write your own commands ! see https://pypi.org/project/ob/

OB is a command line program that you can write your own commands for.


Installation is through pypi:

$ sudo pip3 install ob


Programming your own commands is easy, open /var/lib/ob/mod/hlo.py and add the following code:

def hlo(event):
    event.reply("hello %s" % event.origin)

Now you can type the “hlo” command, showing hello <user>

$ sudo obctl hlo
hello root@console


Object Programming Library provides a library you can use to program objects under python3. It provides a basic BigO Object, that mimics a dict while using attribute access and provides a save/load to/from json files on disk. Objects can be searched with a little database module, provides read-only files to improve persistence and use a type in filename reconstruction.

Basic usage is this:

>>> import op
>>> o = op.Object()
>>> o.set("key", "value")
>>> o.key

Objects try to mimic a dictionary while trying to be an object with normal attribute access as well. Hidden methods are provided as are the basic methods like get, items, keys, register, set, update, values.

The op.obj module provides the basic methods like load and save as a object function using an obj as the first argument:

>>> import op
>>> op.wd = "data"
>>> from op import Object, save, load
>>> o = Object()
>>> o["key"] = "value"
>>> path = save(o)
>>> path
>>> oo = Object()
>>> load(oo, path)
>> oo.key

Great for giving objects peristence by having their state stored in files.


OB has plenty op modules using Object already provided:

ob.adm              - admin
ob.bus              - listeners
ob.clk              - repeater
ob.clt              - clients
ob.cmd              - commands
ob.dbs              - databases
ob.edt              - edit
ob.evt              - events
ob.fnd              - find
ob.hdl              - handler
ob.irc              - bot
ob.itr              - introspection
ok.krn              - kernel
ob.ldr              - loader
ob.log              - logging
ob.opt              - output
ob.prs              - parser
ob.rss              - syndicate
ob.sel              - select
ob.tbl              - table
ob.tdo              - todo
ob.thr              - threads
ob.tms              - times
ob.trc              - trace
ob.trm              - terminal
ob.udp              - relay
ob.url              - locators
ob.usr              - users
ob.utl              - utilities
ob.ver              - version
ob.zzz              - closure


OB is placed in the Public Domain, no COPYRIGHT, no LICENSE.



Contact me on IRC/freenode/#dunkbots or email me at bthate@dds.nl

botfather on #dunkbots irc.freenode.net