sopel-irc / sopel-github

GitHub plugin for Sopel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improvements that can be made for Sopel 7.1

dgw opened this issue · comments

commented

@rule(r'.*(?<!\S)/?#(\d+)\b.*')
@require_chanmsg
def issue_reference(bot, trigger):
"""
Separate function to work around Sopel not loading rules/commands for @url callables.
"""
issue_info(bot, trigger)

This can use the new-to-7.1 sopel.plugin.find decorator, which "Decorate[s] a function to be called for each time a pattern is found in a line." Doing so will fix the current behavior, which is to show information only about the last issue/PR reference in a given line.

Can also combine it with the @url-decorated callable instead of having a separate one, since Sopel 7.1 rewrote a bunch of logic and added tests to make sure that the triggerable decorator types should all work together. Not yet, actually. See sopel-irc/sopel#2378.


I will update this comment as I think of more things that can be improved or simplified.