parseBoolReactionField reads a boolean field from a reaction config map. Returns true if the key is absent (defaults to enabled), or the parsed bool value.
(m map[string]any, key string)
| 130 | // parseBoolReactionField reads a boolean field from a reaction config map. |
| 131 | // Returns true if the key is absent (defaults to enabled), or the parsed bool value. |
| 132 | func parseBoolReactionField(m map[string]any, key string) (bool, error) { |
| 133 | v, ok := m[key] |
| 134 | if !ok { |
| 135 | return true, nil |
| 136 | } |
| 137 | b, ok := v.(bool) |
| 138 | if !ok { |
| 139 | return false, fmt.Errorf("reaction.%s must be a boolean value, got %T", key, v) |
| 140 | } |
| 141 | return b, nil |
| 142 | } |
| 143 | |
| 144 | // intToReactionString converts an integer to a reaction string. |
| 145 | // Only 1 (+1) and -1 are valid integer values for reactions. |
no test coverage detected