yagpdb-cc
yagpdb-cc copied to clipboard
request: Repeatable Github Issue/Pull Auto-Link command
Is your feature request related to a problem? Please describe.
I'd like to be able to use formatted short codes for github/gitlab links, such as #15
or pull#15
to expand to links with arguments for owner, repo, and type (like issues vs pull) to automatically expand in messages, potentially multiple times in a message.
For instance, I'd like to be able to send the following:
Hey all, I'm working on #15 today, and tomorrow I'll pick up #26. I saw other_repo#84 might apply to us, too, but I've got some research to do on that.
and have YAGPDB respond with
Github references in this message:
- #15: <https://github.com/default_owner/default_repo/issues/15>
- #26: <https://github.com/default_owner/default_repo/issues/26>
- other_repo#84: <https://github.com/default_owner/other_repo/issues/84>
I'm confused about how to make this work though; I believe it would need to be a regex command, but the documentation on how to parse a command for multiple triggers in the same message are non-existent, and I'm not sure if it's truly possible to do this the way I want to.
I have the following regex already:
(?:[\W]|^)((?:([^\s\/#]*)[\/#])+(?:([\d]+)))(?:\W|$)
(https://regex101.com/r/MS6002/1)
But I'm not sure how to then parse out all matches as args and convert them to links.
Describe the solution you'd like:
A Custom Command to link to github issues--or some pointers re: templating so that I can use my regex.
Describe alternatives you've considered:
Considered using a separate bot but wasn't able to find one. Have also considered building a separate bot but it feels like that might be overkill. Otoh, let me know if I'm wrong about that :)
Additional context:
None
This is very much possible using reFindAllSubmatches
(which returns all matches of the pattern within the text with their groups) within the custom command code. If you are willing to build it yourself I'm sure there'd be people willing to assist you further in the support server.
Ooh, much appreciated! I'll look at joining the support server this weekend when I'm poking at this again. Feel free to mark this closed if you like. Thanks again!
No problem! I'll keep this open in case someone would like to work on it and submit it to the collection here (could be useful in the support server actually, to link to pull requests.. hm...)