Skip to content
This repository has been archived by the owner on Dec 13, 2024. It is now read-only.

Commit

Permalink
Merge branch 'discord' of https://github.com/Vyxal/VyxalBot2 into dis…
Browse files Browse the repository at this point in the history
…cord
  • Loading branch information
gingershaped committed Dec 4, 2023
2 parents 785788e + d82dc2f commit ddc47f4
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions vyxalbot2/github/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,30 +190,6 @@ async def onPushAction(self, event: GitHubEvent):
if user == event.data["sender"]["login"]:
user = formatUser(event.data["sender"])
yield f"{user} {verb}ed {count} commits ([s]({commits[0]['url']}) [e]({commits[-1]['url']})) to {formatRef(branch, event.data['repository'])} in {formatRepo(event.data['repository'])}: {commits[-1]['message'].splitlines()[0]}"
verb = "force-push" if event.data["forced"] else "push"
if len(event.data["commits"]) <= 5:
for commit in event.data["commits"]:
if not commit["distinct"]:
continue
if event.data["pusher"]["name"] == event.data["sender"]["login"]:
user = formatUser(event.data["sender"])
else:
user = event.data["pusher"]["name"]
yield f"{user} {verb}ed a [commit]({commit['url']}) to {formatRef(branch, event.data['repository'])} in {formatRepo(event.data['repository'])}: {commit['message'].splitlines()[0]}"
else:
counter = Counter()
userCommits = defaultdict(lambda: [])
for commit in event.data["commits"]:
if not commit["distinct"]:
continue
name = event.data["pusher"]["name"]
counter[name] += 1
userCommits[name].append(commit)
for user, count in counter.items():
commits = userCommits[user]
if user == event.data["sender"]["login"]:
user = formatUser(event.data["sender"])
yield f"{user} {verb}ed {count} commits ([s]({commits[0]['url']}) [e]({commits[-1]['url']})) to {formatRef(branch, event.data['repository'])} in {formatRepo(event.data['repository'])}: {commits[-1]['message'].splitlines()[0]}"

@wrap
async def onIssueAction(self, event: GitHubEvent):
Expand Down

0 comments on commit ddc47f4

Please sign in to comment.