Skip to content

Commit

Permalink
fix: tag discord user (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
datphamcode295 authored Dec 23, 2024
1 parent b7aad9a commit 0a009bc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/discord/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ func (d *Client) HandleNewAccessRequest(r types.AccessRequest) error {
fmt.Printf("Failed to get approvers: %v\n", err)
} else {
for _, a := range approvers {
approverIDs += fmt.Sprintf("<@%s> ", a.DiscordID)
if a.TlpUsername != r.GetUser() {
approverIDs += fmt.Sprintf("<@%s> ", a.DiscordID)
}
}
}

requester := r.GetUser()

dbRequester, err := repo.GetUserByTlpUsername(requester)
if err == nil {
requester = dbRequester.DiscordName
requester = fmt.Sprintf("<@%s>", dbRequester.DiscordID)
}

fields := []discordwebhook.Field{
Expand Down Expand Up @@ -116,7 +118,7 @@ func (d *Client) HandleApproveAccessRequest(r types.AccessRequest) error {

dbRequester, err := repo.GetUserByTlpUsername(requester)
if err == nil {
requester = dbRequester.DiscordName
requester = fmt.Sprintf("<@%s>", dbRequester.DiscordID)
}

embed := discordwebhook.Embed{
Expand Down Expand Up @@ -159,7 +161,7 @@ func (d *Client) HandleDenyAccessRequest(r types.AccessRequest) error {

dbRequester, err := repo.GetUserByTlpUsername(requester)
if err == nil {
requester = dbRequester.DiscordName
requester = fmt.Sprintf("<@%s>", dbRequester.DiscordID)
}

embed := discordwebhook.Embed{
Expand Down

0 comments on commit 0a009bc

Please sign in to comment.