Compare commits

...
2 Commits
Author SHA1 Message Date
Dustin Pianalto a21e884bee Fix bug getting messages from db
CI / build (push) Has been cancelled
2021-02-22 22:12:07 -09:00
Dustin Pianalto faf64a8bf9 Add message to end of list with count
CI / build (push) Has been cancelled
2021-02-22 22:03:06 -09:00
2 changed files with 5 additions and 1 deletions
+3
View File
@@ -9,6 +9,7 @@ import (
"github.com/dustinpianalto/disgoman" "github.com/dustinpianalto/disgoman"
"github.com/dustinpianalto/geeksbot" "github.com/dustinpianalto/geeksbot"
"github.com/dustinpianalto/geeksbot/internal/discord_utils" "github.com/dustinpianalto/geeksbot/internal/discord_utils"
"github.com/dustinpianalto/geeksbot/internal/utils"
"github.com/dustinpianalto/geeksbot/pkg/services" "github.com/dustinpianalto/geeksbot/pkg/services"
) )
@@ -247,4 +248,6 @@ func listCommandFunc(ctx disgoman.Context, args []string) {
channelName, channelName,
)) ))
} }
_, _ = ctx.Send(fmt.Sprintf("There are currently %d open %s", len(requests), utils.PluralizeString("request", len(requests))))
} }
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"log" "log"
"github.com/dustinpianalto/geeksbot" "github.com/dustinpianalto/geeksbot"
"github.com/lib/pq"
) )
type messageService struct { type messageService struct {
@@ -21,7 +22,7 @@ func (s messageService) Message(id string) (geeksbot.Message, error) {
WHERE m.id = $1` WHERE m.id = $1`
row := s.db.QueryRow(queryString, id) row := s.db.QueryRow(queryString, id)
err := row.Scan(&m.ID, &m.CreatedAt, &m.ModifiedAt, &m.Content, err := row.Scan(&m.ID, &m.CreatedAt, &m.ModifiedAt, &m.Content,
&m.PreviousContent, &channel_id, &author_id) pq.Array(&m.PreviousContent), &channel_id, &author_id)
if err != nil { if err != nil {
return geeksbot.Message{}, err return geeksbot.Message{}, err
} }