From 82d6988ffd51f24e4b15c523897bdf472c32a7c7 Mon Sep 17 00:00:00 2001 From: shoopea Date: Thu, 21 Jan 2021 15:20:08 +0100 Subject: [PATCH] fix --- rules.go | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/rules.go b/rules.go index cfde0e1..7fa1d37 100644 --- a/rules.go +++ b/rules.go @@ -170,6 +170,20 @@ func resetMsgParsingRules() error { BotCommand: true, } rules2 = append(rules2, r) + + if len(o.Craft.Command) > 6 && o.Craft.Command[0:4] == "/brew_" { + fmt.Printf("Inserting %s\n", o.Code) + r = MessageParsingRule{ + Priority: 9998, + Description: fmt.Sprintf("Specific item brew %s", o.Code), + Rule: fmt.Sprintf("^\\/alch_(?P%s)$", regexp.QuoteMeta(o.Code)), + MsgTypeID64: cacheObjSubType[`msg_bot_brew_item`], + ChatID64: 0, + SenderUserID64: users[id], + BotCommand: true, + } + rules2 = append(rules2, r) + } } } muxObjItem.RUnlock() @@ -218,24 +232,6 @@ func resetMsgParsingRules() error { } rules2 = append(rules2, r) - muxObjItem.RLock() - for _, o := range objItems { - if o.Craft != nil && o.ItemTypeID == cacheObjSubType[`item_misc`] && len(o.Craft.Command) > 6 && o.Craft.Command[0:5] == "/brew_" { - fmt.Printf("Inserting %s\n", o.Code) - r = MessageParsingRule{ - Priority: 9998, - Description: fmt.Sprintf("Specific item brew %s", o.Code), - Rule: fmt.Sprintf("^\\/alch_(?P%s)$", regexp.QuoteMeta(o.Code)), - MsgTypeID64: cacheObjSubType[`msg_bot_brew_item`], - ChatID64: 0, - SenderUserID64: users[id], - BotCommand: true, - } - rules2 = append(rules2, r) - } - } - muxObjItem.RUnlock() - r = MessageParsingRule{ Priority: 9999, Description: "List exchange deals on hold",