mirror of https://github.com/velour/catbase.git
counter:add unicde filter to getItem
This commit is contained in:
parent
3ad86f2308
commit
b2136c1b41
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue