Resolve issue ids using Gitea instead of Trac

This commit is contained in:
Dunedan 2024-09-08 13:43:45 +02:00
parent 562f8f2cc6
commit 1b5d10d676
Signed by: Dunedan
GPG Key ID: 885B16854284E0B2
2 changed files with 4 additions and 4 deletions

View File

@ -45,7 +45,7 @@ def configure(advanced):
conf.registerPlugin('wfg', True)
wfg.ticketUrl.setValue(
something("Specify the URL of the ticketing system instance.", default="https://trac.wildfiregames.com/"))
something("Specify the URL of the ticketing system instance.", default="https://gitea.wildfiregames.com/0ad/0ad/issues/"))
wfg.channels.setValue(
anything("On which irc channels the bot should answer to #. If empty, prints on each joined channel.", default="", acceptEmpty=True))

View File

@ -75,7 +75,7 @@ class wfg(callbacks.Plugin):
if matchobj is not None:
ticket_number = matchobj.group(0).lstrip('#')
ticket_url = self.registryValue('ticketUrl')
url = f'{ticket_url.rstrip("/")}/ticket/{ticket_number}'
url = f'{ticket_url.rstrip("/")}/{ticket_number}'
# Fetch the title of the ticket page
try:
@ -85,11 +85,11 @@ class wfg(callbacks.Plugin):
parser.feed(html)
title = parser.title if parser.title else "No title found"
# Clean up the title if necessary
title = re.sub(r'\s*–\s*Wildfire Games\s*$', '', title)
title = re.sub(r'\s-\s0ad\s-\s*Wildfire Games\s*$', '', title)
except Exception as e:
return
response = f'{title}{url}'
response = f'{title}{response.url}'
irc.queueMsg(ircmsgs.privmsg(channel, response))
Class = wfg