diff --git a/commands/commands.go b/commands/commands.go
index e2bcfab..2f37bb8 100644
--- a/commands/commands.go
+++ b/commands/commands.go
@@ -49,7 +49,7 @@ func help(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
"/help
Sends this help message" + "\n" +
"/gp
List Gaypoints for user or group" + "\n" +
"/remindme 2m,5h,7d <message>
Send a reminder message in 2 minutes, 5 hours, 7 days" + "\n\n" +
- "Admin Commands:" + "\n\n" +
+ "Admin Commands:" + "\n" +
"/addgp <amount>
Add Gaypoints to User" + "\n" +
"/subtractgp <amount>
Add Gaypoints to User" + "\n"
diff --git a/commands/gaypoints/gaypoints.go b/commands/gaypoints/gaypoints.go
index 53de4ab..2441d4e 100644
--- a/commands/gaypoints/gaypoints.go
+++ b/commands/gaypoints/gaypoints.go
@@ -42,13 +42,13 @@ func GetGP(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
gps := sqlGetAllGP(update.Message.Chat.ID)
var messagetext string
- for userid, points := range gps {
- currentUser := botIO.GetUserByID(update.Message.Chat.ID, userid, bot)
+ for _, gaypointInfo := range gps {
+ currentUser := botIO.GetUserByID(update.Message.Chat.ID, gaypointInfo.userID, bot)
currentName := currentUser.User.FirstName
if currentUser.User.UserName != "" {
currentName = currentUser.User.UserName
}
- text := `` + currentName + `` + ` currently has ` + `` + strconv.FormatInt(points, 10) + `` + ` gaypoints` + "\n"
+ text := `` + currentName + `` + ` currently has ` + `` + strconv.FormatInt(gaypointInfo.gaypoints, 10) + `` + ` gaypoints` + "\n"
messagetext = messagetext + text
}
diff --git a/commands/gaypoints/sql.go b/commands/gaypoints/sql.go
index 27c306d..f570ec9 100644
--- a/commands/gaypoints/sql.go
+++ b/commands/gaypoints/sql.go
@@ -13,21 +13,21 @@ var gpSelectChat *sql.Stmt
var gpSet *sql.Stmt
-func sqlGetAllGP(chatid int64) (gaypoints map[int64]int64) {
+func sqlGetAllGP(chatid int64) (gaypoints []gaypointShortDetails) {
rows, err := gpSelectChat.Query(chatid)
if err != nil {
log.Panicf("Failed to query gaypoints: %v\n", err)
}
- gaypoints = make(map[int64]int64)
var c int64
var b int64
for rows.Next() {
switch err := rows.Scan(&c, &b); err {
- case sql.ErrNoRows:
- gaypoints[c] = -1
case nil:
- gaypoints[c] = b
+ gaypoints = append(gaypoints, gaypointShortDetails{
+ userID: c,
+ gaypoints: b,
+ })
default:
log.Panicf("Failed to query gaypoints: %v\n", err)