Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: commit-comment on Discord didn't show the title #208

Merged
merged 1 commit into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/GitHub/events/commit_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async def commit_comment(event, github_api):
"url": event.data["comment"]["html_url"],
"user": event.data["sender"]["login"],
"avatar_url": event.data["sender"]["avatar_url"],
"message": response["commit"]["message"].split("\n")[0],
"first_line": response["commit"]["message"].split("\n")[0],
}

await protocols.dispatch(github_api, repository_name, "commit-comment", payload)
4 changes: 2 additions & 2 deletions plugins/GitHub/protocols/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ async def discussion(hook_urls, repository_name, url, user, avatar_url, action,


@protocols.register("discord", "commit-comment")
async def commit_comment(hook_urls, repository_name, url, user, avatar_url, message):
async def commit_comment(hook_urls, repository_name, url, user, avatar_url, first_line):
message = f"**{repository_name}** - "
message += f":open_mouth: left a comment on commit: {url}\n> {message}"
message += f":open_mouth: left a comment on commit: {url}\n> {first_line}"

await _send_messages(hook_urls, user, avatar_url, message)

Expand Down
4 changes: 2 additions & 2 deletions plugins/GitHub/protocols/irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ async def discussion(channels, repository_name, url, user, avatar_url, action, d


@protocols.register("irc", "commit-comment")
async def commit_comment(channels, repository_name, url, user, avatar_url, message):
message = f"{user} left a comment on commit: {message}"
async def commit_comment(channels, repository_name, url, user, avatar_url, first_line):
message = f"{user} left a comment on commit: {first_line}"

shortened_url = await shorten(url)
_send_messages(channels, [f"[{repository_name}] {message} {shortened_url}"])
Expand Down