Use array of key/value for Twitter hashtags (#1)
With Go, maps are not ordered the way they are declared. Keys can be read at any order. When a pattern is too large ("rtx 3060"), when placed first, it can match a name of another product ("rtx 3060 ti"). When placed second, the good hashtag is chosen. This commit uses an array of maps because arrays are ordered. Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
40b0ba999a
commit
4342f65211
4 changed files with 26 additions and 24 deletions
|
@ -72,7 +72,7 @@ Options:
|
|||
* `consumer_secret`: API secret of your Twitter application
|
||||
* `access_token`: authentication token generated for your Twitter account
|
||||
* `access_token_secret`: authentication token secret generated for your Twitter account
|
||||
* `hashtags`: map of key/values used to append hashtags to each tweet. Key is the pattern to match in the product name, value is the string to append to the tweet. For example, `{"twitter": {"hashtags": {"rtx 3090": "#nvidia #rtx3090"}}}` will detect `rtx 3090` to append `#nvidia #rtx3090` at the end of the tweet.
|
||||
* `hashtags`: list of key/value used to append hashtags to each tweet. Key is the pattern to match in the product name, value is the string to append to the tweet. For example, `{"twitter": {"hashtags": [{"rtx 3090": "#nvidia #rtx3090"}]}}` will detect `rtx 3090` to append `#nvidia #rtx3090` at the end of the tweet.
|
||||
* `include_regex` (optional): include products with a name matching this regexp
|
||||
* `exclude_regex` (optional): exclude products with a name matching this regexp
|
||||
|
||||
|
|
Reference in a new issue