mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-16 08:52:42 +00:00
Add !adv alias, hospital insurance billing, wordle/UNO earnings tracking, streak death protection
- Add !adv shorthand for !adventure commands and DM replies - Hospital bill now shows insurance deduction and amount due - Refactor hospital nudge from per-goroutine sleep to shared ticker - Dead players' streaks are frozen; grace period on revival day - Track wordle earnings in wordle_stats, show in !stats and superstats - Show UNO net earnings and trivia accuracy % in superstats - Disable sentiment/profanity emoji reactions (classification still logs) - Add URL_PREVIEW_IGNORE_USERS env var to skip bot users - Add DISABLE_WOTD_POST env var, remove unused wotd.Prefetch() - README updates for all of the above Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -20,16 +20,26 @@ var urlRe = regexp.MustCompile(`https?://[^\s<>"]+`)
|
||||
// URLsPlugin detects URLs in messages and previews og:title/og:description.
|
||||
type URLsPlugin struct {
|
||||
Base
|
||||
enabled bool
|
||||
httpClient *http.Client
|
||||
enabled bool
|
||||
ignoreUsers map[string]struct{}
|
||||
httpClient *http.Client
|
||||
}
|
||||
|
||||
// NewURLsPlugin creates a new URL preview plugin.
|
||||
func NewURLsPlugin(client *mautrix.Client) *URLsPlugin {
|
||||
enabled := os.Getenv("FEATURE_URL_PREVIEW") != ""
|
||||
ignore := make(map[string]struct{})
|
||||
if raw := os.Getenv("URL_PREVIEW_IGNORE_USERS"); raw != "" {
|
||||
for _, u := range strings.Split(raw, ",") {
|
||||
if u = strings.TrimSpace(u); u != "" {
|
||||
ignore[u] = struct{}{}
|
||||
}
|
||||
}
|
||||
}
|
||||
return &URLsPlugin{
|
||||
Base: NewBase(client),
|
||||
enabled: enabled,
|
||||
Base: NewBase(client),
|
||||
enabled: enabled,
|
||||
ignoreUsers: ignore,
|
||||
httpClient: &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
},
|
||||
@@ -56,6 +66,11 @@ func (p *URLsPlugin) OnMessage(ctx MessageContext) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Skip ignored users (e.g. news bots)
|
||||
if _, ok := p.ignoreUsers[string(ctx.Sender)]; ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
allURLs := urlRe.FindAllString(ctx.Body, -1)
|
||||
// Filter out Matrix internal links (user mentions, room links, etc.)
|
||||
var urls []string
|
||||
|
||||
Reference in New Issue
Block a user