mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 08:32:41 +00:00
Add horoscope, !time @user, profile achievements; fix mention detection and multiple bugs
- Add !horoscope command and daily horoscope digest using Free Horoscope API - Enhance !time to support @user timezone lookups - Add profile completeness achievements (birthday, timezone, both set) - Fix Matrix mention detection in reputation and LLM passive plugins - Fix !whois reputation query (reason string mismatch and calculation) - Fix !time IANA case-sensitivity and username/city collision - Fix timezone default to empty string for achievement detection - Scope all leaderboards to room members (XP, rep, potty, insult, first, rankings, emoji) - Fix XP rank calculation to handle tied scores correctly - Replace skull emoji with bomb for bot insult reactions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -91,9 +91,8 @@ func (p *StreaksPlugin) handleStreak(ctx MessageContext) error {
|
||||
target := ctx.Sender
|
||||
args := p.GetArgs(ctx.Body, "streak")
|
||||
if args != "" {
|
||||
cleaned := strings.TrimSpace(strings.TrimPrefix(args, "@"))
|
||||
if cleaned != "" {
|
||||
target = id.UserID(cleaned)
|
||||
if resolved, ok := p.ResolveUser(args); ok {
|
||||
target = resolved
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,14 +201,15 @@ func calculateStreaks(dates []string) (current int, longest int) {
|
||||
}
|
||||
|
||||
func (p *StreaksPlugin) handleFirstboard(ctx MessageContext) error {
|
||||
members := p.RoomMembers(ctx.RoomID)
|
||||
|
||||
d := db.Get()
|
||||
|
||||
rows, err := d.Query(
|
||||
`SELECT user_id, COUNT(*) as wins
|
||||
FROM daily_first
|
||||
GROUP BY user_id
|
||||
ORDER BY wins DESC
|
||||
LIMIT 10`,
|
||||
ORDER BY wins DESC`,
|
||||
)
|
||||
if err != nil {
|
||||
slog.Error("streaks: firstboard query", "err", err)
|
||||
@@ -222,12 +222,15 @@ func (p *StreaksPlugin) handleFirstboard(ctx MessageContext) error {
|
||||
|
||||
medals := []string{"🥇", "🥈", "🥉"}
|
||||
i := 0
|
||||
for rows.Next() {
|
||||
for rows.Next() && i < 10 {
|
||||
var userID string
|
||||
var wins int
|
||||
if err := rows.Scan(&userID, &wins); err != nil {
|
||||
continue
|
||||
}
|
||||
if members != nil && !members[id.UserID(userID)] {
|
||||
continue
|
||||
}
|
||||
prefix := fmt.Sprintf("#%d", i+1)
|
||||
if i < len(medals) {
|
||||
prefix = medals[i]
|
||||
|
||||
Reference in New Issue
Block a user