kaiyan/emote/store.go
2025-04-20 22:22:51 -04:00

27 lines
869 B
Go

package emote
import (
"context"
"time"
)
// Store is a store of emote usage records.
type Store interface {
// Record stores the emotes in a given message.
Record(ctx context.Context, channel, message, sender string, tm time.Time, emotes []Emote) error
// Metrics appends emote usage information for a channel in a given time range.
Metrics(ctx context.Context, channel string, start, end time.Time, onto []Metric) ([]Metric, error)
}
// Metric is the metrics for a single emote.
type Metric struct {
// Emote is the emote that the metrics describe.
Emote Emote `json:"emote"`
// Tokens is the total number of occurrences of the emote.
Tokens int64 `json:"tokens"`
// Messages is the number of unique messages which contained the emote.
Messages int64 `json:"messages"`
// Users is the number of users who used the emote.
Users int64 `json:"users"`
}