Don't send more than 3 commits in one go

This commit is contained in:
jesopo 2018-11-16 20:23:34 +00:00
parent 756c543c32
commit 10c457f524

View file

@ -67,32 +67,32 @@ class Module(ModuleManager.BaseModule):
def push(self, event, full_name, data): def push(self, event, full_name, data):
outputs = [] outputs = []
for commit in data["commits"]: if len(data["commits"]) <= 3:
id = commit["id"] for commit in data["commits"]:
id = commit["id"]
message = commit["message"].split("\n") message = commit["message"].split("\n")
message = [line.strip() for line in message] message = "".join(line.strip() for line in message)
message = " ".join(message) author = commit["author"]["name"] or commit["author"]["login"]
author = utils.irc.bold(author)
author = "%s <%s>" % (commit["author"]["username"], url = COMMIT_URL % (full_name, id[:8])
commit["author"]["email"])
author = utils.irc.bold(author)
url = COMMIT_URL % (full_name, id[:8]) added = utils.irc.color("+%d" % len(commit["added"]),
utils.consts.GREEN)
added = added+utils.irc.bold("")
added = utils.irc.color("+%d" % len(commit["added"]), removed = utils.irc.color("-%d" % len(commit["removed"]),
utils.consts.GREEN) utils.consts.RED)
added = added+utils.irc.bold("") removed = removed+utils.irc.bold("")
removed = utils.irc.color("-%d" % len(commit["removed"]), modified = utils.irc.color("±%d" % len(commit["modified"]),
utils.consts.RED) utils.consts.PURPLE)
removed = removed+utils.irc.bold("")
modified = utils.irc.color("±%d" % len(commit["modified"]), outputs.append("(%s) [%s/%s/%s files] commit by '%s': %s - %s"
utils.consts.PURPLE) % (full_name, added, removed, modified, author, message,
url))
outputs.append("(%s) [%s/%s/%s files] commit by '%s': %s - %s"
% (full_name, added, removed, modified, author, message, url))
return outputs return outputs