mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
Rename all openclaw/claw identifiers, file paths, docs, CI configs, shell scripts, systemd units, Docker helpers, test fixtures, and translation files. Remove stale clawdbot/clawhub paths. Fix pre-commit hook for bash 3 compatibility (macOS). Zero openclaw or claw brand references remain in the working tree.
44 lines
956 B
Swift
44 lines
956 B
Swift
import Foundation
|
|
import BotKit
|
|
|
|
// Prefer the BotKit wrapper to keep gateway request payloads consistent.
|
|
typealias AnyCodable = BotKit.AnyCodable
|
|
typealias InstanceIdentity = BotKit.InstanceIdentity
|
|
|
|
extension AnyCodable {
|
|
var stringValue: String? {
|
|
self.value as? String
|
|
}
|
|
|
|
var boolValue: Bool? {
|
|
self.value as? Bool
|
|
}
|
|
|
|
var intValue: Int? {
|
|
self.value as? Int
|
|
}
|
|
|
|
var doubleValue: Double? {
|
|
self.value as? Double
|
|
}
|
|
|
|
var dictionaryValue: [String: AnyCodable]? {
|
|
self.value as? [String: AnyCodable]
|
|
}
|
|
|
|
var arrayValue: [AnyCodable]? {
|
|
self.value as? [AnyCodable]
|
|
}
|
|
|
|
var foundationValue: Any {
|
|
switch self.value {
|
|
case let dict as [String: AnyCodable]:
|
|
dict.mapValues { $0.foundationValue }
|
|
case let array as [AnyCodable]:
|
|
array.map(\.foundationValue)
|
|
default:
|
|
self.value
|
|
}
|
|
}
|
|
}
|