diff --git a/lorebot/botfunc.go b/lorebot/botfunc.go index 4f5ae6f..82e249e 100644 --- a/lorebot/botfunc.go +++ b/lorebot/botfunc.go @@ -34,6 +34,12 @@ func loreNewString(nick, newString, newType string, redisClient *redis.Client) e stripContent := strings.Replace(fmt.Sprintf("%s", content), "<", "", -1) stripLinks := strings.Replace(stripContent, ">", "", -1) + // dont allow certain chars + if strings.ContainsAny(command, ";:,.'\"!$%^*()/\\") { + // reject user input, it has unwanted chars + return errors.New("error: entry contains unwanted characters") + } + t := time.Now() // create a timestamp to use diff --git a/lorebot/lorebot.go b/lorebot/lorebot.go index 66e3d6c..1c57eda 100644 --- a/lorebot/lorebot.go +++ b/lorebot/lorebot.go @@ -319,13 +319,6 @@ func lorestatus(rtm *slack.RTM, ev *slack.MessageEvent, redisClient *redis.Clien } func newhandler(rtm *slack.RTM, ev *slack.MessageEvent, message, newType string, redisClient *redis.Client) { - // dont allow certain chars - //if strings.ContainsAny(message, ";:,.'\"!$%^*()/\\") { - // // reject user input, it has unwanted chars - // rtm.SendMessage(rtm.NewOutgoingMessage("entry could not be created, unwanted characters", ev.Channel)) - // return - //} - // get nick from slack api user, err := rtm.GetUserInfo(ev.User) if err != nil {