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

Use discord username from config #217

Merged
merged 3 commits into from
Feb 26, 2023
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ This will display help for the tool. Here are all the switches it supports.
| `-proxy` | http proxy to use with notify | `notify -proxy http://127.0.0.1:8080` |
| `-rate-limit` | maximum number of HTTP requests to send per second | `notify -rl 1` |
| `-silent` | enable silent mode | `notify -silent` |
| `-verbose` | enable verbose mode | `notify -version` |
| `-verbose` | enable verbose mode | `notify -verbose` |
| `-version` | display version | `notify -version` |


Expand Down
5 changes: 4 additions & 1 deletion pkg/providers/discord/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package discord

import (
"fmt"
"net/url"

"github.com/containrrr/shoutrrr"
"github.com/oriser/regroup"
Expand Down Expand Up @@ -51,7 +52,9 @@ func (p *Provider) Send(message, CliFormat string) error {
}

webhookID, webhookToken := matchedGroups["webhook_identifier"], matchedGroups["webhook_token"]
url := fmt.Sprintf("discord://%s@%s?splitlines=no", webhookToken, webhookID)
url := fmt.Sprintf("discord://%s@%s?splitlines=no&username=%s", webhookToken, webhookID,
url.QueryEscape(pr.DiscordWebHookUsername))

sendErr := shoutrrr.Send(url, msg)
if sendErr != nil {
sendErr = errors.Wrap(sendErr, fmt.Sprintf("failed to send discord notification for id: %s ", pr.ID))
Expand Down