One more fix to the fact spitter.

Turns out channels have case.
This commit is contained in:
Chris Sexton 2013-06-16 22:40:30 -04:00
parent eff200ee15
commit 76e6644b8b
1 changed files with 4 additions and 3 deletions

View File

@ -130,9 +130,10 @@ func (b *Bot) LastMessage(channel string) (Message, error) {
if len(log) == 0 { if len(log) == 0 {
return Message{}, errors.New("No messages found.") return Message{}, errors.New("No messages found.")
} }
for i := len(log); i > 0; i-- { for i := len(log) - 1; i >= 0; i-- {
if log[i].Channel == channel { msg := log[i]
return log[i], nil if strings.ToLower(msg.Channel) == strings.ToLower(channel) {
return msg, nil
} }
} }
return Message{}, errors.New("No messages found.") return Message{}, errors.New("No messages found.")