Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
986d16b346 | ||
|
|
83c41e2788 | ||
|
|
24aff1be72 | ||
|
|
b28beaba0c | ||
|
|
4f8aaff94a | ||
|
|
a21e884bee | ||
|
|
faf64a8bf9 | ||
|
|
2abe574977 | ||
|
|
04c32955c7 | ||
|
|
1f70318d26 | ||
|
|
47ed519376 |
@@ -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"
|
||||
)
|
||||
|
||||
@@ -234,7 +235,7 @@ func listCommandFunc(ctx disgoman.Context, args []string) {
|
||||
|
||||
_, _ = ctx.Send(fmt.Sprintf("```md\n"+
|
||||
"< Request ID Requested By >\n"+
|
||||
"< %11s %-23s >\n"+
|
||||
"< %-11d %23s >\n"+
|
||||
"%s\n\n"+
|
||||
"Comments: Not Implemented Yet\n"+
|
||||
"Requested At: %s\n"+
|
||||
@@ -247,4 +248,6 @@ func listCommandFunc(ctx disgoman.Context, args []string) {
|
||||
channelName,
|
||||
))
|
||||
}
|
||||
|
||||
_, _ = ctx.Send(fmt.Sprintf("```There %s currently %d open %s```", utils.PluralizeString("is", len(requests)), len(requests), utils.PluralizeString("request", len(requests))))
|
||||
}
|
||||
|
||||
@@ -17,5 +17,8 @@ func PluralizeString(s string, i int) string {
|
||||
if i == 1 {
|
||||
return s
|
||||
}
|
||||
if s == "is" {
|
||||
return "are"
|
||||
}
|
||||
return s + "s"
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -0,0 +1,6 @@
|
||||
BEGIN;
|
||||
ALTER TABLE servers
|
||||
DROP COLUMN ftp_port,
|
||||
DROP COLUMN ftp_username,
|
||||
DROP COLUMN ftp_password;
|
||||
COMMIT;
|
||||
@@ -0,0 +1,6 @@
|
||||
BEGIN;
|
||||
ALTER TABLE servers
|
||||
ADD COLUMN ftp_port int4,
|
||||
ADD COLUMN ftp_username varchar(200),
|
||||
ADD COLUMN ftp_password varchar(200);
|
||||
COMMIT;
|
||||
@@ -19,11 +19,12 @@ func (s serverService) ServerByID(id int) (geeksbot.Server, error) {
|
||||
var iMsgID sql.NullString
|
||||
var sMsgID sql.NullString
|
||||
queryString := `SELECT id, name, ip_address, port, password, alerts_channel_id,
|
||||
guild_id, info_channel_id, info_message_id, settings_message_id
|
||||
guild_id, info_channel_id, info_message_id, settings_message_id,
|
||||
ftp_port, ftp_username, ftp_password
|
||||
FROM servers WHERE id = $1`
|
||||
row := s.db.QueryRow(queryString, id)
|
||||
err := row.Scan(&server.ID, &server.Name, &server.IPAddr, &server.Port, &server.Password,
|
||||
&aChanID, &guildID, &iChanID, &iMsgID, &sMsgID)
|
||||
&aChanID, &guildID, &iChanID, &iMsgID, &server.FTPPort, &server.FTPUser, &server.FTPPass, &sMsgID)
|
||||
if err != nil {
|
||||
return geeksbot.Server{}, err
|
||||
}
|
||||
@@ -115,7 +116,8 @@ func (s serverService) DeleteServer(server geeksbot.Server) error {
|
||||
func (s serverService) UpdateServer(server geeksbot.Server) (geeksbot.Server, error) {
|
||||
queryString := `UPDATE servers SET name = $2, ip_address = $3, port = $4, password = $5,
|
||||
alerts_channel_id = $6, info_channel_id = $7, info_message_id = $8,
|
||||
settings_message_id = $9 WHERE id = $1`
|
||||
settings_message_id = $9, ftp_port = $10, ftp_username = $11,
|
||||
ftp_password = $12 WHERE id = $1`
|
||||
_, err := s.db.Exec(queryString,
|
||||
server.Name,
|
||||
server.IPAddr,
|
||||
@@ -125,6 +127,9 @@ func (s serverService) UpdateServer(server geeksbot.Server) (geeksbot.Server, er
|
||||
server.InfoChannel.ID,
|
||||
server.InfoMessage.ID,
|
||||
server.SettingsMessage.ID,
|
||||
server.FTPPort,
|
||||
server.FTPUser,
|
||||
server.FTPPass,
|
||||
)
|
||||
return server, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user