Skip to content

Commit

Permalink
Fix: commit-comment on Discord didn't show the title (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueBrain authored Mar 10, 2024
1 parent 1130038 commit 8299a73
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
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

0 comments on commit 8299a73

Please sign in to comment.