X-Git-Url: http://git.kaliko.me/?a=blobdiff_plain;f=sid%2Fplugin.py;h=b21cff9e0897c556d0248abc3cd4ae2e68bcfb54;hb=54565dde76562668aac0c6949619d8db040e3f67;hp=6ff12eed45f01194df1597082f105d8519c3a242;hpb=dbc1b2e6149234b8571425b6684a2858fa52c545;p=sid.git diff --git a/sid/plugin.py b/sid/plugin.py index 6ff12ee..b21cff9 100644 --- a/sid/plugin.py +++ b/sid/plugin.py @@ -17,10 +17,15 @@ from .sid import botcmd + class Plugin: - """Simple Plugin object to derive from: - Exposes the bot object and its logger - Provides some send helpers + """ + Simple Plugin object to derive from: + + * Exposes the bot object and its logger + * Provides send helpers + + :param sid.sid.MUCBot bot: bot the plugin is load from """ def __init__(self, bot): @@ -29,10 +34,17 @@ class Plugin: def send(self, dest, msg, mtype='chat'): """Send msg to dest - msg = { - mbody: 'text', - mhtml: 'text, # optional' - } + + :param str dest: Message recipient + :param dict,str msg: Message to send (use dict for xhtml-im) + + .. note:: + if **msg** is a :py:obj:`dict` to provide xhmlt-im massages:: + + msg = { + mbody: 'text', + mhtml: 'text, # optional' + } """ if isinstance(msg, str): msg = {'mbody': msg} @@ -43,7 +55,11 @@ class Plugin: def reply(self, rcv, msg): """Smart reply to message received. - Replies in private or on the muc depending on + + Replies ``msg`` in private or on the muc depending on ``rcv`` + + :param rcv: The received message (slixmpp object) + :param dict,str msg: The message to reply, refer to :py:obj:`sid.plugin.Plugin.send` for ``msg`` format """ to = rcv['from'] if rcv['type'] == 'groupchat':