通知
列出通知
| 参数 | 类型 | 默认值 | 说明 |
|---|
limit | number | 50 | 最大通知数 |
offset | number | 0 | 分页偏移量 |
const notifications = await client.listNotifications(50, 0)
notifications = client.list_notifications(limit=50, offset=0)
标记通知已读
PATCH /api/notifications/:id/read
await client.markNotificationRead('notification-id')
client.mark_notification_read("notification-id")
标记全部已读
POST /api/notifications/read-all
await client.markAllNotificationsRead()
client.mark_all_notifications_read()
按范围标记已读
POST /api/notifications/read-scope
将特定服务器或频道的所有通知标记为已读。
| 字段 | 类型 | 说明 |
|---|
serverId | string | 服务器 ID(可选) |
channelId | string | 频道 ID(可选) |
await client.markScopeRead({ serverId: 'server-id' })
client.mark_scope_read(server_id="server-id")
获取未读数量
GET /api/notifications/unread-count
const { count } = await client.getUnreadCount()
result = client.get_unread_count()
count = result["count"]
获取分类未读数量
GET /api/notifications/scoped-unread
返回按服务器/频道分组的未读计数。
const scoped = await client.getScopedUnread()
scoped = client.get_scoped_unread()
获取通知偏好设置
GET /api/notifications/preferences
const prefs = await client.getNotificationPreferences()
prefs = client.get_notification_preferences()
更新通知偏好设置
PATCH /api/notifications/preferences
| 字段 | 类型 | 说明 |
|---|
strategy | string | all、mention_only 或 none |
mutedServerIds | string[] | 要静音的服务器 ID |
mutedChannelIds | string[] | 要静音的频道 ID |
const updated = await client.updateNotificationPreferences({
strategy: 'mention_only',
mutedServerIds: ['server-1'],
})
updated = client.update_notification_preferences(
strategy="mention_only",
mutedServerIds=["server-1"],
)