Support adding github webhooks for an entire "username" (github.py)

This commit is contained in:
jesopo 2019-01-03 21:18:40 +00:00
parent cb3e40a462
commit 498352d1ac

View file

@ -47,6 +47,7 @@ class Module(ModuleManager.BaseModule):
return "" return ""
full_name = data["repository"]["full_name"] full_name = data["repository"]["full_name"]
repo_username, repo_name = full_name.split("/", 1)
hooks = self.bot.database.channel_settings.find_by_setting( hooks = self.bot.database.channel_settings.find_by_setting(
"github-hook") "github-hook")
targets = [] targets = []
@ -54,7 +55,7 @@ class Module(ModuleManager.BaseModule):
repo_hooked = False repo_hooked = False
for i, (server_id, channel_name, hooked_repos) in list( for i, (server_id, channel_name, hooked_repos) in list(
enumerate(hooks))[::-1]: enumerate(hooks))[::-1]:
if full_name in hooked_repos: if repo_username in hooked_repos or full_name in hooked_repos:
repo_hooked = True repo_hooked = True
server = self.bot.get_server(server_id) server = self.bot.get_server(server_id)
if server and channel_name in server.channels: if server and channel_name in server.channels: