mirror of https://github.com/velour/catbase.git
Change Splits to Fields where appropriate
This commit is contained in:
parent
e4f4cae6a7
commit
19754a07a5
|
@ -128,7 +128,7 @@ func (p *CounterPlugin) Message(message msg.Message) bool {
|
|||
// This bot does not reply to anything
|
||||
nick := message.User.Name
|
||||
channel := message.Channel
|
||||
parts := strings.Split(message.Body, " ")
|
||||
parts := strings.Fields(message.Body)
|
||||
|
||||
if len(parts) == 0 {
|
||||
return false
|
||||
|
|
|
@ -659,7 +659,7 @@ func (p *Factoid) RegisterWeb() *string {
|
|||
}
|
||||
|
||||
func linkify(text string) template.HTML {
|
||||
parts := strings.Split(text, " ")
|
||||
parts := strings.Fields(text)
|
||||
for i, word := range parts {
|
||||
if strings.HasPrefix(word, "http") {
|
||||
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
|
||||
parts := strings.Split(message.Body, " ")
|
||||
parts := strings.Fields(message.Body)
|
||||
if message.Command && len(parts) >= 3 &&
|
||||
strings.ToLower(parts[0]) == "remember" {
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ func (p *LeftpadPlugin) Message(message msg.Message) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
parts := strings.Split(message.Body, " ")
|
||||
parts := strings.Fields(message.Body)
|
||||
if len(parts) > 3 && parts[0] == "leftpad" {
|
||||
padchar := parts[1]
|
||||
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") {
|
||||
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]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue