types: add SlackEmoji to the deposit struct

This commit is contained in:
c9s 2024-11-14 15:48:26 +08:00
parent 70d26ff775
commit 78d3ff14c8
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -28,6 +28,21 @@ const (
DepositCredited = DepositStatus("credited")
)
func (s DepositStatus) SlackEmoji() string {
switch s {
case DepositPending:
return ":hourglass_not_done:"
case DepositCredited:
return ":dollar_banknote:"
case DepositSuccess:
return ":check_mark_button:"
case DepositCancelled:
return ":stop_button:"
}
return ""
}
type Deposit struct {
GID int64 `json:"gid" db:"gid"`
Exchange ExchangeName `json:"exchange" db:"exchange"`
@ -106,7 +121,7 @@ func (d *Deposit) SlackAttachment() slack.Attachment {
if len(d.Status) > 0 {
fields = append(fields, slack.AttachmentField{
Title: "Status",
Value: string(d.Status),
Value: string(d.Status) + " " + d.Status.SlackEmoji(),
Short: false,
})
}