From b2136c1b411518e52f3cb5a9014e9d586c671fed Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Mon, 25 Nov 2019 14:26:26 -0500 Subject: [PATCH] counter:add unicde filter to getItem --- plugins/counter/counter.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/counter/counter.go b/plugins/counter/counter.go index 309ff47..66a47f6 100644 --- a/plugins/counter/counter.go +++ b/plugins/counter/counter.go @@ -122,6 +122,7 @@ func MkAlias(db *sqlx.DB, item, pointsTo string) (*alias, error) { // GetItem returns a specific counter for a subject func GetItem(db *sqlx.DB, nick, itemName string) (Item, error) { + itemName = trimUnicode(itemName) var item Item item.DB = db var a alias @@ -220,6 +221,10 @@ func New(b bot.Bot) *CounterPlugin { return cp } +func trimUnicode(s string) string { + return strings.Trim(s, string(rune(0xFE0F))) +} + // Message responds to the bot hook on recieving messages. // 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