X-Git-Url: http://git.kaliko.me/?a=blobdiff_plain;f=sid%2Fbts.py;h=1a7fea46640ceb48340ec85191f6085adad5d7c0;hb=912b046c8bdf24a2e8a477269256ad99593f0728;hp=201df9a0fb5c8bfbb3704d520567f0fa842a78df;hpb=034db6aba932f1e955732ad8f7bb7f226e8f9231;p=sid.git diff --git a/sid/bts.py b/sid/bts.py index 201df9a..1a7fea4 100644 --- a/sid/bts.py +++ b/sid/bts.py @@ -31,7 +31,8 @@ class Bugs(Plugin): 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""" @@ -65,7 +66,7 @@ class Bugs(Plugin): @botcmd def bugs(self, rcv, args): - """ intercepts bugs number in any message, looking for string like #629234 and display bug summary. + """Intercepts bugs number in messages (as #629234), reply a bug summary. !bugs pkg-name : Returns latest bug reports if any """ if not args: @@ -83,11 +84,9 @@ class Bugs(Plugin): 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) -