diff --git a/lorebot/botfunc.go b/lorebot/botfunc.go index 18941f1..4f5ae6f 100644 --- a/lorebot/botfunc.go +++ b/lorebot/botfunc.go @@ -31,6 +31,8 @@ func loreCheck(searchTerm, searchType string, redisClient *redis.Client) (string func loreNewString(nick, newString, newType string, redisClient *redis.Client) error { s := strings.SplitN(newString, " ", 2) command, content := s[0], []byte(s[1]) + stripContent := strings.Replace(fmt.Sprintf("%s", content), "<", "", -1) + stripLinks := strings.Replace(stripContent, ">", "", -1) t := time.Now() @@ -39,7 +41,7 @@ func loreNewString(nick, newString, newType string, redisClient *redis.Client) e // create the redis hash _, err := redisClient.HMSet(fmt.Sprintf("%s:%s", newType, command), map[string]string{ - "content": string(content), + "content": stripLinks, "cdate": cdate, "owner": nick, }).Result() diff --git a/lorebot/lorebot.go b/lorebot/lorebot.go index 31cf72a..66e3d6c 100644 --- a/lorebot/lorebot.go +++ b/lorebot/lorebot.go @@ -320,11 +320,12 @@ 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 - } + //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 {