mirror of https://github.com/velour/catbase.git
Fix obvious problems
This commit is contained in:
parent
10beb0a34f
commit
c261b53ae6
|
@ -6,6 +6,7 @@ import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
|
@ -274,7 +275,7 @@ func (p *CounterPlugin) Message(message msg.Message) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
subject := strings.ToLower(nick)
|
subject := strings.ToLower(nick)
|
||||||
itemName := strings.ToLower(parts[0])[:len(parts[0])-2]
|
itemName := strings.ToLower(parts[0])
|
||||||
|
|
||||||
if nameParts := strings.SplitN(itemName, ".", 2); len(nameParts) == 2 {
|
if nameParts := strings.SplitN(itemName, ".", 2); len(nameParts) == 2 {
|
||||||
subject = nameParts[0]
|
subject = nameParts[0]
|
||||||
|
@ -289,7 +290,7 @@ func (p *CounterPlugin) Message(message msg.Message) bool {
|
||||||
// Item ain't there, I guess
|
// Item ain't there, I guess
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
n := strconv.Atoi(parts[2])
|
n, _ := strconv.Atoi(parts[2])
|
||||||
log.Printf("About to update item by %d: %#v", n, item)
|
log.Printf("About to update item by %d: %#v", n, item)
|
||||||
item.UpdateDelta(n)
|
item.UpdateDelta(n)
|
||||||
p.Bot.SendMessage(channel, fmt.Sprintf("%s has %d %s.", subject,
|
p.Bot.SendMessage(channel, fmt.Sprintf("%s has %d %s.", subject,
|
||||||
|
@ -303,7 +304,7 @@ func (p *CounterPlugin) Message(message msg.Message) bool {
|
||||||
// Item ain't there, I guess
|
// Item ain't there, I guess
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
n := strconv.Atoi(parts[2])
|
n, _ := strconv.Atoi(parts[2])
|
||||||
log.Printf("About to update item by -%d: %#v", n, item)
|
log.Printf("About to update item by -%d: %#v", n, item)
|
||||||
item.UpdateDelta(-n)
|
item.UpdateDelta(-n)
|
||||||
p.Bot.SendMessage(channel, fmt.Sprintf("%s has %d %s.", subject,
|
p.Bot.SendMessage(channel, fmt.Sprintf("%s has %d %s.", subject,
|
||||||
|
|
Loading…
Reference in New Issue