feat(onebot): expose account session uptime
Expose account session uptime in status queries, matching the built-in status reply. Fixes #486
This commit is contained in:
9 files changed
+46
-6
No files matched your search
@@ -126,6 +126,8 @@ bot.when(
|
||||
|
||||
## Raw Action
|
||||
|
||||
`await bot.getStatus()` 的 `time` 为当前账号服务实例的运行秒数,与 `#sl` 使用相同计时起点;实例重建后重新计时。
|
||||
|
||||
高频接口提供 camelCase 方法;其它 SnowLuma action 可以用 `raw` 或 `rawResponse`:
|
||||
|
||||
```ts
|
||||
|
||||
@@ -25,6 +25,8 @@ export interface LoginInfo {
|
||||
export interface StatusInfo {
|
||||
online: boolean;
|
||||
good: boolean;
|
||||
/** Current account-session uptime in seconds, matching #sl. */
|
||||
time: number;
|
||||
}
|
||||
|
||||
export interface VersionInfo {
|
||||
|
||||
@@ -146,6 +146,13 @@ describe('SnowLumaApiClient.rawResponse', () => {
|
||||
});
|
||||
|
||||
describe('SnowLumaApiClient typed actions', () => {
|
||||
it('exposes account-session uptime through getStatus', async () => {
|
||||
const client = okClient({ online: true, good: true, time: 90 });
|
||||
const status = await client.getStatus();
|
||||
const seconds: number = status.time;
|
||||
expect(seconds).toBe(90);
|
||||
});
|
||||
|
||||
it('maps session helpers to empty-param OneBot actions', async () => {
|
||||
const client = okClient();
|
||||
const timeout = { timeoutMs: 2500 };
|
||||
|
||||
Reference in new issue
Block a user