Browse Source

added debug and fixed indexes

master
David Haukeness 5 years ago
parent
commit
984efecf7e
No known key found for this signature in database
GPG Key ID: 54F2372DDB7F9462
  1. 5
      commands.go

5
commands.go

@ -78,16 +78,17 @@ func (b *bot) handleFeedback(m chat1.MsgSummary) {
// handleSetCommand processes all settings SET calls // handleSetCommand processes all settings SET calls
func (b *bot) handleSetCommand(m chat1.MsgSummary) { func (b *bot) handleSetCommand(m chat1.MsgSummary) {
b.debug("%s called set command in %s", m.Sender.Username, m.ConvID)
// first normalize the text and extract the arguments // first normalize the text and extract the arguments
args := strings.Fields(strings.ToLower(m.Content.Text.Body)) args := strings.Fields(strings.ToLower(m.Content.Text.Body))
if args[1] != "set" { if args[1] != "set" {
return return
} }
switch len(args) { switch len(args) {
case 3: case 4:
if args[2] == "url" { if args[2] == "url" {
// first validate the URL // first validate the URL
u, err := url.ParseRequestURI(args[2]) u, err := url.ParseRequestURI(args[3])
if err != nil { if err != nil {
eid := b.logError(err) eid := b.logError(err)
b.k.ReactByConvID(m.ConvID, m.Id, "Error ID %s", eid) b.k.ReactByConvID(m.ConvID, m.Id, "Error ID %s", eid)

Loading…
Cancel
Save