mirror of https://github.com/velour/catbase.git
One more fix to the fact spitter.
Turns out channels have case.
This commit is contained in:
parent
eff200ee15
commit
76e6644b8b
|
@ -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.")
|
||||||
|
|
Loading…
Reference in New Issue