Skip to content

Commit

Permalink
add displayName
Browse files Browse the repository at this point in the history
  • Loading branch information
walnuts1018 committed Mar 31, 2024
1 parent 0035431 commit 4b09fda
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,13 @@ func (c *Client) ForwardMessage(ctx context.Context, everythingChannelID string,
slog.Error("Error getting user profile", "error", err)
}

var iconURL string
var iconURL, displayName string
if profile == nil {
iconURL = ""
displayName = message.User
} else {
iconURL = profile.Image512
displayName = profile.DisplayName
}

permalink, err := c.slackClient.GetPermalinkContext(ctx, &slack.PermalinkParameters{
Expand Down Expand Up @@ -263,6 +265,7 @@ func (c *Client) ForwardMessage(ctx context.Context, everythingChannelID string,
),
slack.MsgOptionDisableLinkUnfurl(),
slack.MsgOptionIconURL(iconURL),
slack.MsgOptionUsername(displayName),
)
return err
}
Expand Down

0 comments on commit 4b09fda

Please sign in to comment.