Documentation
¶
Index ¶
- Constants
- func MarkdownTable(rows []RankedCount, nameTitle string) string
- func RenderMarkdown(report ActivityReport) (string, error)
- func UpdateReadme(readme []byte, section string) []byte
- func WriteReadme(path string, section string) error
- type ActivityReport
- type ChannelDigest
- type Digest
- type DigestOptions
- type DigestTotals
- type Options
- type Quiet
- type QuietChannel
- type QuietOptions
- type QuietTotals
- type RankedCount
- type Trends
- type TrendsOptions
- type TrendsRow
- type WeeklyCount
- type WindowStats
Constants ¶
const ( StartMarker = "<!-- discrawl-report:start -->" EndMarker = "<!-- discrawl-report:end -->" )
Variables ¶
This section is empty.
Functions ¶
func MarkdownTable ¶
func MarkdownTable(rows []RankedCount, nameTitle string) string
func RenderMarkdown ¶
func RenderMarkdown(report ActivityReport) (string, error)
func UpdateReadme ¶
func WriteReadme ¶
Types ¶
type ActivityReport ¶
type ActivityReport struct {
GeneratedAt time.Time
LatestMessageAt time.Time
TotalMessages int
TotalChannels int
TotalMembers int
Windows []WindowStats
TopChannels []RankedCount
TopAuthors []RankedCount
BusiestDays []RankedCount
}
type ChannelDigest ¶
type ChannelDigest struct {
ChannelID string `json:"channel_id"`
ChannelName string `json:"channel_name"`
Kind string `json:"kind,omitempty"`
GuildID string `json:"guild_id"`
Messages int `json:"messages"`
Replies int `json:"replies"`
ActiveAuthors int `json:"active_authors"`
TopPosters []RankedCount `json:"top_posters"`
TopMentions []RankedCount `json:"top_mentions"`
}
ChannelDigest is the per-channel roll-up inside a Digest.
type Digest ¶
type Digest struct {
GeneratedAt time.Time `json:"generated_at"`
Since time.Time `json:"since"`
Until time.Time `json:"until"`
WindowLabel string `json:"window_label"`
Guild string `json:"guild,omitempty"`
Channel string `json:"channel,omitempty"`
TopN int `json:"top_n"`
Channels []ChannelDigest `json:"channels"`
Totals DigestTotals `json:"totals"`
}
Digest summarizes recent activity for each channel inside a window.
func BuildDigest ¶
BuildDigest computes a per-channel activity digest from the local store.
type DigestOptions ¶
type DigestOptions struct {
Now time.Time
Since time.Duration
GuildID string
Channel string
TopN int
}
DigestOptions controls how a Digest is built.
type DigestTotals ¶
type DigestTotals struct {
Messages int `json:"messages"`
Replies int `json:"replies"`
Channels int `json:"channels"`
ActiveAuthors int `json:"active_authors"`
}
DigestTotals sums message and channel counts across the digest window.
type Quiet ¶
type Quiet struct {
GeneratedAt time.Time `json:"generated_at"`
Since time.Time `json:"since"`
Until time.Time `json:"until"`
Guild string `json:"guild,omitempty"`
Channels []QuietChannel `json:"channels"`
Totals QuietTotals `json:"totals"`
}
Quiet summarizes channels with no activity in a window.
func BuildQuiet ¶
BuildQuiet computes channels with no messages newer than the lookback window.
type QuietChannel ¶
type QuietChannel struct {
ChannelID string `json:"channel_id"`
ChannelName string `json:"channel_name"`
Kind string `json:"kind,omitempty"`
GuildID string `json:"guild_id"`
LastMessage string `json:"last_message,omitempty"`
DaysSilent int `json:"days_silent"`
}
QuietChannel is one channel with no recent activity.
type QuietOptions ¶
QuietOptions controls how a Quiet report is built.
type QuietTotals ¶
type QuietTotals struct {
Channels int `json:"channels"`
}
QuietTotals summarizes quiet-channel counts.
type RankedCount ¶
type Trends ¶
type Trends struct {
GeneratedAt time.Time `json:"generated_at"`
Since time.Time `json:"since"`
Until time.Time `json:"until"`
Weeks int `json:"weeks"`
Guild string `json:"guild,omitempty"`
Channel string `json:"channel,omitempty"`
Rows []TrendsRow `json:"rows"`
}
Trends summarizes week-over-week message volume per channel.
func BuildTrends ¶
BuildTrends computes Monday-start UTC weekly message counts per channel.
type TrendsOptions ¶
TrendsOptions controls how a Trends report is built.
type TrendsRow ¶
type TrendsRow struct {
GuildID string `json:"guild_id"`
ChannelID string `json:"channel_id"`
ChannelName string `json:"channel_name"`
Kind string `json:"kind,omitempty"`
Weekly []WeeklyCount `json:"weekly"`
}
TrendsRow is one channel's weekly message trend.
type WeeklyCount ¶
WeeklyCount is the message count for one Monday-start UTC week.