Skip to content

Commit

Permalink
fix: 修复词云中可能存在panic的地方 (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
yqchilde authored Feb 26, 2023
1 parent aaa9245 commit fdcca88
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/wordcloud/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ func init() {
}
// 剔除消息中的艾特
if strings.HasPrefix(msg.Content, "@") {
msg.Content = msg.Content[strings.Index(msg.Content, " "):]
if strings.Contains(msg.Content, " ") {
msg.Content = msg.Content[strings.Index(msg.Content, " "):]
} else {
msg.Content = msg.Content[1:]
}
}
words += msg.Content + " "
}
Expand Down

0 comments on commit fdcca88

Please sign in to comment.