@botcmd
def archive(self, rcv, args):
- """Fetch pkg info from the archive:
+ """Fetch pkg versions info from the archive:
!archive pkg-name : Returns package versions (by suite)
"""
def __init__(self, bot):
Plugin.__init__(self, bot)
- bot.add_event_handler("muc::%s::message" % self.bot.room, self.muc_message)
+ bot.add_event_handler("muc::%s::message" %
+ self.bot.room, self.muc_message)
def muc_message(self, msg):
"""Handler method dealing with MUC incoming messages"""
return
reports = debianbts.get_status(reports_ids)
reports = sorted(reports, key=lambda r: r.date)
- rprt_nb = len(reports)
- msg = ['Open reports for {1} (total {0})'.format(rprt_nb, pkg.string)]
+ msg = ['Latest reports for {1} (total {0})'.format(len(reports), pkg.string)]
# Reverse and take last reports
for rep in reports[::-1][:4]:
msg.append('{r.bug_num}: {r.date:%Y-%m-%d} {r.subject}'.format(r=rep))
message = {'mbody': '\n'.join(msg)}
self.reply(rcv, message)
-
from .plugin import Plugin, botcmd
+
class Echo(Plugin):
"""Drop a message to be sent when someone gets online.
"""
# any presences you send yourself. To limit event handling
# to a single room, use the events muc::room@server::presence,
# muc::room@server::got_online, or muc::room@server::got_offline.
- bot.add_event_handler("muc::%s::presence" % self.bot.room, self.log_presence)
+ bot.add_event_handler("muc::%s::presence" %
+ self.bot.room, self.log_presence)
def log_presence(self, pres):
"""Register presence"""
# coding: utf-8
+# Copyright (C) 2020 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/>.
+
import json
import logging
try:
response = urlopen(req)
ans = response.read()
- #print(response.getcode())
except HTTPError as err:
logger.info('The server couldn\'t fulfill the request.')
logger.debug('Error code: %s', err.code)
from .plugin import Plugin, botcmd
+
class Ping(Plugin):
PongURL = 'http://upload.wikimedia.org/wikipedia/commons/f/f8/Pong.png'
from .sid import botcmd
+
class Plugin:
"""
Simple Plugin object to derive from: