Nag
Nag decides when to show a "please support" message.
Nag decides when to show a "please support" message. Create one with Client.Nag. It never signs the user in.
type Nag struct {
// contains filtered or unexported fields
}Methods#
Due#
func (n *Nag) Due(ctx context.Context, predicate func(*Result) bool, opts ...DueOption) boolDue counts this run (once per process per ID; in mock mode once per Client, in memory) and reports whether the nag should be shown: predicate(result) && (runs >= Every || time since last shown >= OrEvery). A nil predicate counts as true. Due is always false when Sponsorkit is disabled, and, unless Force is given, when SPONSORKIT_NO_NAG or CI is set or stdout/stderr is not a terminal. Runs are counted even when the result is false.
Shown#
func (n *Nag) Shown()Shown records that the nag was shown: it resets the run counter and sets the last-shown time.