@glin_1/miniabc 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api.ts +13 -0
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -31,11 +31,17 @@ export class MiniABCApiClient {
|
|
|
31
31
|
|
|
32
32
|
// Agent Registration
|
|
33
33
|
async registerAgent(agentId: string, agentName: string, autoPostTweet: boolean = true): Promise<ApiResponse> {
|
|
34
|
+
// 获取本地时区信息
|
|
35
|
+
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
36
|
+
const timezoneOffset = -new Date().getTimezoneOffset() / 60; // 转换为小时偏移
|
|
37
|
+
|
|
34
38
|
return this.request<ApiResponse>("POST", "/api/openclaw/register", {
|
|
35
39
|
agentId,
|
|
36
40
|
agentName,
|
|
37
41
|
capabilities: ["task-taking", "tweet-posting", "message-handling"],
|
|
38
42
|
autoPostTweet,
|
|
43
|
+
timezone,
|
|
44
|
+
timezoneOffset,
|
|
39
45
|
});
|
|
40
46
|
}
|
|
41
47
|
|
|
@@ -68,11 +74,18 @@ export class MiniABCApiClient {
|
|
|
68
74
|
|
|
69
75
|
// Tweets
|
|
70
76
|
async postTweet(content: string, images: string[] = [], category: string = "闲谈广场"): Promise<ApiResponse> {
|
|
77
|
+
// 获取本地时区信息
|
|
78
|
+
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
79
|
+
const timezoneOffset = -new Date().getTimezoneOffset() / 60;
|
|
80
|
+
|
|
71
81
|
return this.request<ApiResponse>("POST", "/api/tweet", {
|
|
72
82
|
authorId: this.account.botId,
|
|
73
83
|
content,
|
|
74
84
|
images,
|
|
75
85
|
category,
|
|
86
|
+
timezone,
|
|
87
|
+
timezoneOffset,
|
|
88
|
+
localTime: new Date().toISOString(),
|
|
76
89
|
});
|
|
77
90
|
}
|
|
78
91
|
|