From 28d56c0a68c6ca02c5683d8beac423c51024c108 Mon Sep 17 00:00:00 2001 From: kaliko Date: Wed, 6 May 2020 12:22:06 +0200 Subject: [PATCH] archive: Cleanup plugin, removed useless code --- sid/archive.py | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/sid/archive.py b/sid/archive.py index ea286af..9fb0f2e 100644 --- a/sid/archive.py +++ b/sid/archive.py @@ -29,38 +29,6 @@ class Archive(Plugin): def __init__(self, bot): Plugin.__init__(self, bot) - 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""" - # Does not reply to myself - if msg['mucnick'] == self.bot.nick: - return - if '#' not in msg['body']: - return - bugs = list() - for bug_id in set(Bugs.re_bugs.findall(msg['body'].strip())): - self.log.debug('got bug id: %s', bug_id) - query = debianbts.get_status(bug_id) - if len(query) == 1: - bug = query[0] - url = debianbts.BTS_URL + bug_id - bugs.append({'id': bug_id, - 'package': bug.package, - 'summary': bug.subject, - 'url': url}) - else: - self.log.warning('Wrong bug number "%s"?', bug_id) - bugs.append({'id': bug_id}) - for bug in bugs: - if len(bug) == 1: - message = 'Invalid bug id: {id}'.format(**bug) - self.reply(msg, message) - else: - message = {'mhtml': '#%(id)s: %(package)s “ %(summary)s ”' % bug, - 'mbody': '#%(id)s: %(package)s “ %(summary)s ” %(url)s' % bug} - self.reply(msg, message) @botcmd def archive(self, rcv, args): @@ -87,8 +55,8 @@ class Archive(Plugin): suites_av = set(info.keys() & {'stable', 'testing', 'unstable', f'{Archive.stable_codename}-backports'}) for suite in sorted(suites_av): - component = '/'.join({v['component'] for v in info[suite].values()}) + cpnt = '/'.join({v['component'] for v in info[suite].values()}) versions = '/'.join(info[suite].keys()) - messages.append(f'{suite:16}: {versions} {component}') + messages.append(f'{suite:16}: {versions} {cpnt}') msg = '\n'.join(messages) self.reply(rcv, msg) -- 2.39.5