counter:add unicde filter to getItem

This commit is contained in:
Chris Sexton 2019-11-25 14:26:26 -05:00 committed by Chris Sexton
parent 3ad86f2308
commit b2136c1b41
1 changed files with 5 additions and 0 deletions

View File

@ -122,6 +122,7 @@ func MkAlias(db *sqlx.DB, item, pointsTo string) (*alias, error) {
// GetItem returns a specific counter for a subject // GetItem returns a specific counter for a subject
func GetItem(db *sqlx.DB, nick, itemName string) (Item, error) { func GetItem(db *sqlx.DB, nick, itemName string) (Item, error) {
itemName = trimUnicode(itemName)
var item Item var item Item
item.DB = db item.DB = db
var a alias var a alias
@ -220,6 +221,10 @@ func New(b bot.Bot) *CounterPlugin {
return cp return cp
} }
func trimUnicode(s string) string {
return strings.Trim(s, string(rune(0xFE0F)))
}
// Message responds to the bot hook on recieving messages. // Message responds to the bot hook on recieving messages.
// This function returns true if the plugin responds in a meaningful way to the // This function returns true if the plugin responds in a meaningful way to the
// users message. Otherwise, the function returns false and the bot continues // users message. Otherwise, the function returns false and the bot continues