X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sid%2Fplugin.py;h=2b49bc9da22c9d3a57f1c02a6793da770a3c1221;hb=735d4b0a13a92f2dea11f051d60ae82baec23bed;hp=671df850cdd73ea3edf7420fcfcd0cfa21b4442b;hpb=8050b8698ff1f6294abceb8b022a4aecdbe8375e;p=sid.git diff --git a/sid/plugin.py b/sid/plugin.py index 671df85..2b49bc9 100644 --- a/sid/plugin.py +++ b/sid/plugin.py @@ -21,6 +21,22 @@ class Plugin(object): def __init__(self, bot): self.bot = bot + self.log = bot.log + + def send(self, msg): + """ + Send msg to the current groupchat defined in self.bot.room + msg = { + mbody: 'text', + mhtml: 'text, # optional' + } + """ + if isinstance(msg, str): + msg = {'mbody':msg} + msg.setdefault('mhtml', None) + self.bot.send_message(mto=self.bot.room, + mtype='groupchat', + **msg) def shutdown(self): pass