Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add attrs to !check output. Ensure unique !add attrs. #6

Merged
merged 1 commit into from
Mar 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading