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

Commit

Permalink
Merge branch 'main' into discord
Browse files Browse the repository at this point in the history
  • Loading branch information
gingershaped committed Nov 29, 2023
2 parents 8023b47 + 520f43a commit 9108981
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Byte-compiled / optimized / DLL files
__pycache__/
**/__pycache__/
*.py[cod]
*$py.class

Expand Down
26 changes: 26 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ bs4 = "^0.0.1"
uwuipy = "^0.1.7"

[tool.poetry.group.dev.dependencies]
black = {version = "^23.9.1", allow-prereleases = true}
black = {version = "^23.11.0", allow-prereleases = true}

[build-system]
requires = ["poetry-core"]
Expand Down
24 changes: 24 additions & 0 deletions vyxalbot2/github/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,30 @@ 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 9108981

Please sign in to comment.