Skip to content

Commit

Permalink
Merge pull request #6 from leighmacdonald/check_attrs
Browse files Browse the repository at this point in the history
Add attrs to !check output. Ensure unique !add attrs.
  • Loading branch information
leighmacdonald authored Mar 23, 2024
2 parents adc602c + 58ae9bb commit c2c9e94
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 c2c9e94

Please sign in to comment.