added debug and fixed indexes
This commit is contained in:
@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user