Skip to content

Commit

Permalink
Add attrs to !check output. Ensure unique attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmacdonald committed Mar 23, 2024
1 parent adc602c commit 58ae9bb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"log/slog"
"net/http"
"slices"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -91,7 +92,9 @@ func addEntry(ctx context.Context, database *sql.DB, sid steamid.SteamID, msg []
attrs = append(attrs, "cheater")
} else {
for i := 2; i < len(msg); i++ {
attrs = append(attrs, msg[i])
if !slices.Contains(attrs, msg[i]) {
attrs = append(attrs, msg[i])
}
}
}

Expand Down Expand Up @@ -123,8 +126,8 @@ func checkEntry(ctx context.Context, database *sql.DB, sid steamid.SteamID) (str
}

return fmt.Sprintf(":skull_crossbones: %s is a confirmed baddie :skull_crossbones: "+
"https://steamcommunity.com/profiles/%d \nAuthor: <@%d>\nCreated: %s",
player.LastSeen.PlayerName, sid.Int64(), player.Author, player.CreatedOn.String()), nil
"https://steamcommunity.com/profiles/%d \nAttributes: %s\nAuthor: <@%d>\nCreated: %s",
player.LastSeen.PlayerName, sid.Int64(), strings.Join(player.Attributes, ","), player.Author, player.CreatedOn.String()), nil
}

func getSteamid(sid steamid.SteamID) string {
Expand Down

0 comments on commit 58ae9bb

Please sign in to comment.