From: kaliko Date: Mon, 20 Dec 2021 13:18:47 +0000 (+0100) Subject: bugs: intercepts bug id in URLs as well (closes #1) X-Git-Tag: 0.3.0~22 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=a456be5ab5facfe20c89bc3eefdce458752a150f;p=sid.git bugs: intercepts bug id in URLs as well (closes #1) --- diff --git a/sid/bts.py b/sid/bts.py index 2835eff..03eef51 100644 --- a/sid/bts.py +++ b/sid/bts.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Copyright (C) 2010, 2011 Anaël Verrier -# Copyright (C) 2015, 2020 kaliko +# Copyright (C) 2015, 2021 kaliko # 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 @@ -29,7 +29,9 @@ class Bugs(Plugin): .. note:: This plugin depends on external module: **python-debianbts** """ - re_bugs = re_compile(r'(?<=#)(\d{6,7})') + #: Bug id regexp, intercepts bug id in strings : "#629234", "bugs.debian.org/629234" and "bugreport.cgi?bug=629234" + re_bugs = re_compile(r'(?:(?<=#)|(?<=bugreport\.cgi\?bug=)|(?<=bugs\.debian\.org/))(\d{6,7})') + #: Package name regexp re_pkg = re_compile(r'(?P[0-9a-z.+-]+)$') def __init__(self, bot): @@ -45,8 +47,6 @@ class Bugs(Plugin): # 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)