Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a21e884bee | ||
|
|
faf64a8bf9 | ||
|
|
2abe574977 | ||
|
|
04c32955c7 | ||
|
|
1f70318d26 | ||
|
|
47ed519376 | ||
|
|
22912c7367 | ||
|
|
6b15540d4e |
@@ -32,4 +32,6 @@ func AddCommandHandlers(g *disgoman.CommandManager) {
|
||||
_ = g.AddCommand(guild.SelfAssignRoleCommand)
|
||||
_ = g.AddCommand(guild.UnAssignRoleCommand)
|
||||
_ = g.AddCommand(requests.RequestCommand)
|
||||
_ = g.AddCommand(requests.CloseCommand)
|
||||
_ = g.AddCommand(requests.ListCommand)
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/dustinpianalto/disgoman"
|
||||
"github.com/dustinpianalto/geeksbot"
|
||||
"github.com/dustinpianalto/geeksbot/internal/discord_utils"
|
||||
"github.com/dustinpianalto/geeksbot/internal/utils"
|
||||
"github.com/dustinpianalto/geeksbot/pkg/services"
|
||||
)
|
||||
|
||||
@@ -247,4 +248,6 @@ func listCommandFunc(ctx disgoman.Context, args []string) {
|
||||
channelName,
|
||||
))
|
||||
}
|
||||
|
||||
_, _ = ctx.Send(fmt.Sprintf("There are currently %d open %s", len(requests), utils.PluralizeString("request", len(requests))))
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"log"
|
||||
|
||||
"github.com/dustinpianalto/geeksbot"
|
||||
"github.com/lib/pq"
|
||||
)
|
||||
|
||||
type messageService struct {
|
||||
@@ -21,7 +22,7 @@ func (s messageService) Message(id string) (geeksbot.Message, error) {
|
||||
WHERE m.id = $1`
|
||||
row := s.db.QueryRow(queryString, id)
|
||||
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 {
|
||||
return geeksbot.Message{}, err
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
BEGIN;
|
||||
ALTER TABLE messages
|
||||
ALTER COLUMN previous_content DROP NOT NULL;
|
||||
ALTER TABLE messages
|
||||
ALTER COLUMN previous_content DROP DEFAULT;
|
||||
COMMIT;
|
||||
@@ -0,0 +1,6 @@
|
||||
BEGIN;
|
||||
ALTER TABLE messages
|
||||
ALTER COLUMN previous_content SET NOT NULL;
|
||||
ALTER TABLE messages
|
||||
ALTER COLUMN previous_content SET DEFAULT array[]::varchar[];
|
||||
COMMIT;
|
||||
@@ -19,7 +19,7 @@ func (s requestService) Request(id int64) (geeksbot.Request, error) {
|
||||
var uID sql.NullString
|
||||
var mID string
|
||||
queryString := `SELECT id, author_id, channel_id, guild_id, content, requested_at, completed,
|
||||
completed_at, completed_by, message_id, completed_message
|
||||
completed_at, completed_by, message_id, completed_message FROM requests
|
||||
WHERE id = $1`
|
||||
row := s.db.QueryRow(queryString, id)
|
||||
err := row.Scan(&r.ID, &aID, &cID, &gID, &r.Content, &r.RequestedAt, &r.Completed,
|
||||
@@ -168,7 +168,7 @@ func (s requestService) Comment(id int64) (geeksbot.Comment, error) {
|
||||
var c geeksbot.Comment
|
||||
var aID string
|
||||
var rID int64
|
||||
queryString := "SELECT id, author_id, request_id, comment_at, content WHERE id = $1"
|
||||
queryString := "SELECT id, author_id, request_id, comment_at, content FROM comments WHERE id = $1"
|
||||
row := s.db.QueryRow(queryString, id)
|
||||
err := row.Scan(&c.ID, &aID, &rID, &c.CommentAt, &c.Content)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user