mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(notifications): add Size to Discord notification (#1075)
* feat(discord): add Size to notification. * adjust positioning * add additional fields
This commit is contained in:
parent
b3957ac447
commit
a97574f64a
1 changed files with 25 additions and 0 deletions
|
@ -16,6 +16,7 @@ import (
|
|||
"github.com/autobrr/autobrr/internal/domain"
|
||||
"github.com/autobrr/autobrr/pkg/errors"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
|
@ -205,6 +206,30 @@ func (a *discordSender) buildEmbed(event domain.NotificationEvent, payload domai
|
|||
}
|
||||
fields = append(fields, f)
|
||||
}
|
||||
if payload.Size > 0 {
|
||||
f := DiscordEmbedsFields{
|
||||
Name: "Size",
|
||||
Value: humanize.Bytes(payload.Size),
|
||||
Inline: true,
|
||||
}
|
||||
fields = append(fields, f)
|
||||
}
|
||||
if len(payload.Protocol) != 0 {
|
||||
f := DiscordEmbedsFields{
|
||||
Name: "Protocol",
|
||||
Value: payload.Protocol.String(),
|
||||
Inline: true,
|
||||
}
|
||||
fields = append(fields, f)
|
||||
}
|
||||
if len(payload.Implementation) != 0 {
|
||||
f := DiscordEmbedsFields{
|
||||
Name: "Implementation",
|
||||
Value: payload.Implementation.String(),
|
||||
Inline: true,
|
||||
}
|
||||
fields = append(fields, f)
|
||||
}
|
||||
if len(payload.Rejections) > 0 {
|
||||
f := DiscordEmbedsFields{
|
||||
Name: "Reasons",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue