]> kaliko git repositories - sid.git/commitdiff
Add ping comand
authorkaliko <kaliko@azylum.org>
Sat, 15 Nov 2014 13:34:43 +0000 (14:34 +0100)
committerkaliko <kaliko@azylum.org>
Sat, 15 Nov 2014 13:34:43 +0000 (14:34 +0100)
sid/ping.py [new file with mode: 0644]

diff --git a/sid/ping.py b/sid/ping.py
new file mode 100644 (file)
index 0000000..827ddb6
--- /dev/null
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2014 kaliko <kaliko@azylum.org>
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, version 3 only.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from .plugin import Plugin, botcmd
+
+class Ping(Plugin):
+    PongURL = 'http://upload.wikimedia.org/wikipedia/commons/f/f8/Pong.png'
+
+    def __init__(self, bot):
+        Plugin.__init__(self, bot)
+
+    @botcmd
+    def ping(self, message, args):
+        """ping's answering a pong showing the bot is alive.
+        !ping : You'll get back "pong"!
+        """
+        msg = {
+                'mhtml':'!<a href="{0.PongURL}">pong</a>'.format(self),
+                'mbody':'!pong',
+                }
+        self.send(msg)
+
+# VIM MODLINE
+# vim: ai ts=4 sw=4 sts=4 expandtab