Documentation
¶
Overview ¶
Package dailyreport provides functionality for generating and sending daily PR reports to users.
Index ¶
Constants ¶
View Source
const (
// MinHoursBetweenReports is the minimum time between daily reports (20 hours).
MinHoursBetweenReports = 20
)
Variables ¶
This section is empty.
Functions ¶
func BuildReportMessage ¶
BuildReportMessage creates a formatted message for a daily report.
Types ¶
type DiscordDMSender ¶
type DiscordDMSender interface {
SendDM(ctx context.Context, userID, text string) (channelID, messageID string, err error)
}
DiscordDMSender sends DMs to users.
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender handles sending daily reports to users.
func NewSender ¶
func NewSender(stateStore StateStore, logger *slog.Logger) *Sender
NewSender creates a new daily report sender.
func (*Sender) RegisterGuild ¶
func (s *Sender) RegisterGuild(guildID string, sender DiscordDMSender)
RegisterGuild registers a DM sender for a guild.
func (*Sender) SendReport ¶
func (s *Sender) SendReport(ctx context.Context, userInfo UserBlockingInfo) error
SendReport sends a daily report to a user.
func (*Sender) ShouldSendReport ¶
func (s *Sender) ShouldSendReport(ctx context.Context, userInfo UserBlockingInfo) bool
ShouldSendReport determines if a report should be sent to a user now. Note: Caller should check if user is active before calling this.
type StateStore ¶
type StateStore interface {
DailyReportInfo(ctx context.Context, userID string) (state.DailyReportInfo, bool)
SaveDailyReportInfo(ctx context.Context, userID string, info state.DailyReportInfo) error
}
StateStore handles persistence of report send times.
Click to show internal directories.
Click to hide internal directories.