From 811db2aee40abf093b6f06168c6cdb98a5c62d12 Mon Sep 17 00:00:00 2001 From: datphamcode295 Date: Mon, 23 Dec 2024 17:42:50 +0700 Subject: [PATCH] fix: tag discord user --- internal/discord/client.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/discord/client.go b/internal/discord/client.go index 4a12827..ac4b6bf 100644 --- a/internal/discord/client.go +++ b/internal/discord/client.go @@ -49,7 +49,9 @@ 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) + } } } @@ -57,7 +59,7 @@ func (d *Client) HandleNewAccessRequest(r types.AccessRequest) error { dbRequester, err := repo.GetUserByTlpUsername(requester) if err == nil { - requester = dbRequester.DiscordName + requester = fmt.Sprintf("<@%s>", dbRequester.DiscordID) } fields := []discordwebhook.Field{ @@ -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{ @@ -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{