dailyreport

package
v0.0.0-...-229e418 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

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

func BuildReportMessage(incoming, outgoing []discord.PRSummary) string

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.

type UserBlockingInfo

type UserBlockingInfo struct {
	GitHubUsername string
	DiscordUserID  string
	GuildID        string
	IncomingPRs    []discord.PRSummary
	OutgoingPRs    []discord.PRSummary
}

UserBlockingInfo contains information about PRs a user is blocking.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL