]> kaliko git repositories - sid.git/blob - sid/plugin.py
2b49bc9da22c9d3a57f1c02a6793da770a3c1221
[sid.git] / sid / plugin.py
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2010, 2011 AnaĆ«l Verrier <elghinn@free.fr>
4 # Copyright (C) 2014 kaliko <kaliko@azylum.org>
5
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, version 3 only.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 from .sid import botcmd
19
20 class Plugin(object):
21
22     def __init__(self, bot):
23         self.bot = bot
24         self.log = bot.log
25
26     def send(self, msg):
27         """
28         Send msg to the current groupchat defined in self.bot.room
29             msg = {
30                 mbody: 'text',
31                 mhtml: '<b>text</b>,  # optional'
32             }
33         """
34         if isinstance(msg, str):
35             msg = {'mbody':msg}
36         msg.setdefault('mhtml', None)
37         self.bot.send_message(mto=self.bot.room,
38                               mtype='groupchat',
39                               **msg)
40
41     def shutdown(self):
42         pass