mirror of https://github.com/velour/catbase.git
Merge pull request #26 from velour/FieldsVsSplits
Change Splits to Fields where appropriate
This commit is contained in:
commit
a0d0f79884
|
@ -128,7 +128,7 @@ func (p *CounterPlugin) Message(message msg.Message) bool {
|
||||||
// This bot does not reply to anything
|
// This bot does not reply to anything
|
||||||
nick := message.User.Name
|
nick := message.User.Name
|
||||||
channel := message.Channel
|
channel := message.Channel
|
||||||
parts := strings.Split(message.Body, " ")
|
parts := strings.Fields(message.Body)
|
||||||
|
|
||||||
if len(parts) == 0 {
|
if len(parts) == 0 {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -659,7 +659,7 @@ func (p *Factoid) RegisterWeb() *string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func linkify(text string) template.HTML {
|
func linkify(text string) template.HTML {
|
||||||
parts := strings.Split(text, " ")
|
parts := strings.Fields(text)
|
||||||
for i, word := range parts {
|
for i, word := range parts {
|
||||||
if strings.HasPrefix(word, "http") {
|
if strings.HasPrefix(word, "http") {
|
||||||
parts[i] = fmt.Sprintf("<a href=\"%s\">%s</a>", word, word)
|
parts[i] = fmt.Sprintf("<a href=\"%s\">%s</a>", word, word)
|
||||||
|
|
|
@ -47,7 +47,7 @@ func (p *RememberPlugin) Message(message msg.Message) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
user := message.User
|
user := message.User
|
||||||
parts := strings.Split(message.Body, " ")
|
parts := strings.Fields(message.Body)
|
||||||
if message.Command && len(parts) >= 3 &&
|
if message.Command && len(parts) >= 3 &&
|
||||||
strings.ToLower(parts[0]) == "remember" {
|
strings.ToLower(parts[0]) == "remember" {
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ func (p *LeftpadPlugin) Message(message msg.Message) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
parts := strings.Split(message.Body, " ")
|
parts := strings.Fields(message.Body)
|
||||||
if len(parts) > 3 && parts[0] == "leftpad" {
|
if len(parts) > 3 && parts[0] == "leftpad" {
|
||||||
padchar := parts[1]
|
padchar := parts[1]
|
||||||
length, err := strconv.Atoi(parts[2])
|
length, err := strconv.Atoi(parts[2])
|
||||||
|
|
|
@ -69,7 +69,7 @@ func (p *TalkerPlugin) Message(message msg.Message) bool {
|
||||||
|
|
||||||
if message.Command && strings.HasPrefix(lowermessage, "goatse") {
|
if message.Command && strings.HasPrefix(lowermessage, "goatse") {
|
||||||
nick := message.User.Name
|
nick := message.User.Name
|
||||||
if parts := strings.Split(message.Body, " "); len(parts) > 1 {
|
if parts := strings.Fields(message.Body); len(parts) > 1 {
|
||||||
nick = parts[1]
|
nick = parts[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue