Skip to content
This repository has been archived by the owner on Sep 2, 2020. It is now read-only.

Commit

Permalink
sentimental plugin: fix username detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ucirello committed Jan 7, 2016
1 parent 2dc7078 commit 86dd9f2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/gochatbot-plugin-sentimental/sentimental.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (r SentimentalPlugin) helpMessage() string {

func (r *SentimentalPlugin) parseMessage(in *messages.Message) error {
msg := strings.TrimSpace(in.Message)
checkPrefix := r.botName + " check on"
checkPrefix := r.botName + " check on "
if msg == "" || (strings.HasPrefix(msg, r.botName) && !strings.HasPrefix(msg, checkPrefix)) {
return nil
}
Expand All @@ -86,7 +86,8 @@ func (r *SentimentalPlugin) parseMessage(in *messages.Message) error {
Message: "no sentiment on anybody collected yet",
})
}
username := strings.TrimPrefix(strings.TrimSpace(msg), checkPrefix)
username := strings.TrimSpace(strings.TrimPrefix(strings.TrimSpace(msg), checkPrefix))
log.Printf("sentimental: checking user `%s`", username)
if username == "everyone" {
var out string
for u, sc := range scorecard {
Expand Down

0 comments on commit 86dd9f2

Please # to comment.