通知

列出通知

GET /api/notifications
参数类型默认值说明
limitnumber50最大通知数
offsetnumber0分页偏移量
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

将特定服务器或频道的所有通知标记为已读。

字段类型说明
serverIdstring服务器 ID(可选)
channelIdstring频道 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
字段类型说明
strategystringallmention_onlynone
mutedServerIdsstring[]要静音的服务器 ID
mutedChannelIdsstring[]要静音的频道 ID
const updated = await client.updateNotificationPreferences({
  strategy: 'mention_only',
  mutedServerIds: ['server-1'],
})
updated = client.update_notification_preferences(
    strategy="mention_only",
    mutedServerIds=["server-1"],
)