diff --git a/.vitepress/theme/index.scss b/.vitepress/theme/index.scss index f2d1d09..7fb1c35 100644 --- a/.vitepress/theme/index.scss +++ b/.vitepress/theme/index.scss @@ -21,3 +21,28 @@ blockquote.route { .vp-doc sup a { text-decoration: none; } + +.adapter-table { + display: grid; + grid-template-columns: repeat(3, 1fr); + grid-gap: 1rem 1rem; + + a.adapter { + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 4rem; + border-radius: 12px; + background-color: var(--vp-c-bg-soft); + transition: all 0.3s ease; + text-decoration: none; + color: var(--vp-c-text); + cursor: pointer; + user-select: none; + } + + .adapter:hover { + background-color: var(--vp-c-bg-alt); + } +} diff --git a/en-US/introduction.md b/en-US/introduction.md index e10b99d..f060bff 100644 --- a/en-US/introduction.md +++ b/en-US/introduction.md @@ -1 +1,31 @@ # Introduction + +Satori is a universal chat protocol. We aim for Satori to bridge the differences between various chat platforms, enabling developers to create cross-platform, scalable, and high-performance chat applications at a lower cost. + +The name "Satori" is inspired by the character Komeiji Satori from the game Touhou Project. Komeiji Satori can communicate with various animals through telepathy, and this name was chosen in the hope that Satori can serve as a bridge between different chat platforms. + +The Satori development team has long been engaged in chatbot development and is familiar with the communication methods of various chat platforms. After four years of development, Satori has a robust design and mature implementation. Currently, Satori officially provides adapters for over 15 chat platforms, fully covering the world's mainstream chat platforms: + +
+ DingTalk + Discord + KOOK + Lark + LINE + Email + Matrix + QQ + Slack + Telegram + WeChat Official Account + WeCom + HoYoLAB + WhatsApp + Zulip +
+ +These adapters not only provide an out-of-the-box experience but also practically demonstrate the universality and extensibility of the Satori protocol. + +You don’t need to worry about losing control over chat platforms when using Satori. Thanks to Satori’s internal interface mechanism, you can write generic code in most cases and use internal interfaces to implement platform-specific features when needed. + +Additionally, Satori offers a complete solution for large-scale scenarios. Whether it’s a chatbot on a personal computer or a chat platform backend on a distributed cluster, Satori can meet your needs. diff --git a/en-US/resources/channel.md b/en-US/resources/channel.md index 0454af3..f1eedd7 100644 --- a/en-US/resources/channel.md +++ b/en-US/resources/channel.md @@ -2,32 +2,97 @@ ## Definition -### Channel +### Channel {#def-channel} | FIELD | TYPE | DESCRIPTION | | ----- | ---- | ----------- | | id | string | channel ID | -| name | string | channel name | +| type | [ChannelType](#channeltype) | channel type | +| name | string? | channel name | +| parent_id | string? | parent channel ID | + +### ChannelType + +| 名称 | 值 | 描述 | +| --- | --- | --- | +| TEXT | 0 | text channel | +| DIRECT | 1 | direct message channel | +| CATEGORY | 2 | category channel | +| VOICE | 3 | voice channel | ## API -### Get Channel +### Get Guild Channel {#api-channel-get} -- POST `/v1/channel.get` +> POST `/channel.get` {.route} | FIELD | TYPE | DESCRIPTION | | ----- | ---- | ----------- | | channel_id | string | channel ID | -Get a channel by ID. Returns a [channel](#channel-1) object. +Get a channel by ID. Returns a [Channel](#def-channel) object. -### bot.getChannelList(guildId, next?) +### Get Guild Channel List {#api-channel-list} -- POST `/v1/channel.list` +> POST `/channel.list` {.route} | FIELD | TYPE | DESCRIPTION | | ----- | ---- | ----------- | | guild_id | string | guild ID | | next | string | pagination token | -Get channels in a guild. Returns a [list](../protocol/api.md#pagination) of [channel](#channel-1) objects. +Get all channels in a guild. Returns a [List](../protocol/api.md#list) of [Channel](#def-channel) objects. + +### Create Guild Channel {#api-channel-create} + +> POST `/channel.create` {.route} + +| FIELD | TYPE | DESCRIPTION | +| --- | --- | --- | +| guild_id | string | guild ID | +| data | [Channel](#def-channel) | channel data | + +Create a guild channel. Returns a [Channel](#def-channel) object. + +### Update Guild Channel {#api-channel-update} + +> POST `/channel.update` {.route} + +| FIELD | TYPE | DESCRIPTION | +| --- | --- | --- | +| channel_id | string | channel ID | +| data | [Channel](#def-channel) | channel data | + +Update a guild channel. + +### Delete Guild Channel {#api-channel-delete} + +> POST `/channel.delete` {.route} + +| FIELD | TYPE | DESCRIPTION | +| --- | --- | --- | +| channel_id | string | channel ID | + +Delete a guild channel. + +### Mute Guild Channel Experimental {#api-channel-mute} + +> POST `/channel.mute` {.route} + +| FIELD | TYPE | DESCRIPTION | +| --- | --- | --- | +| channel_id | string | channel ID | +| duration | number | mute duration (in milliseconds) | + +Mute a guild channel. If the duration is set to 0, it will unmute the channel. + +### Create Direct Message Channel {#api-user-channel-create} + +> POST `/user.channel.create` {.route} + +| FIELD | TYPE | DESCRIPTION | +| --- | --- | --- | +| user_id | string | user ID | +| guild_id | string? | guild ID | + +Create a direct message channel. Returns a [Channel](#def-channel) object. diff --git a/en-US/resources/guild.md b/en-US/resources/guild.md index 55abe8b..3a7f5c5 100644 --- a/en-US/resources/guild.md +++ b/en-US/resources/guild.md @@ -2,40 +2,62 @@ ## Definition -### Guild +### Guild {#def-guild} | FIELD | TYPE | DESCRIPTION | | ----- | ---- | ----------- | | id | string | guild ID | -| name | string | guild name | +| name | string? | guild name | +| avatar | string? | guild avatar | ## API -### bot.getGuild(guildId) +### Get Guild {#api-guild-get} -- POST `/v1/guild.get` +> POST `/guild.get` {.route} | FIELD | TYPE | DESCRIPTION | | ----- | ---- | ----------- | | guild_id | string | guild ID | -Get a guild by ID. Returns a [guild](#guild-1) object. +Get a guild by ID. Returns a [Guild](#def-guild) object. -### bot.getGuildList(next?) +### Get Guild List {#api-guild-list} -- POST `/v1/guild.list` +> POST `/guild.list` {.route} | FIELD | TYPE | DESCRIPTION | | ----- | ---- | ----------- | | next | string | pagination token | -Get guilds where the current user is a member. Returns a [list](../protocol/api.md#pagination) of partial [guild](#guild-1) objects. +Get guilds where the current user is a member. Returns a [List](../protocol/api.md#list) of partial [Guild](#def-guild) objects. -### bot.handleGuildRequest(messageId, approve, comment?) +### Handle Guild Invitation {#api-guild-approve} -- **messageId:** `string` 请求 ID -- **approve:** `boolean` 是否通过请求 -- **comment:** `string` 备注信息 -- 返回值: `Promise` +> POST `/guild.approve` {.route} -处理来自群组的邀请。 +| FIELD | TYPE | DESCRIPTION | +| --- | --- | --- | +| message_id | string | request ID | +| approve | boolean | whether to approve the request | +| comment | string? | comment | + +Handle an invitation from a guild. + +## Events + +### guild-added + +Triggered when joining a guild. Required resource: `guild`. + +### guild-updated + +Triggered when a guild is modified. Required resource: `guild`. + +### guild-removed + +Triggered when leaving a guild. Required resource: `guild`. + +### guild-request + +Triggered when receiving a new guild invitation. Required resource: `guild`. diff --git a/zh-CN/introduction.md b/zh-CN/introduction.md index e4062f9..9fe5421 100644 --- a/zh-CN/introduction.md +++ b/zh-CN/introduction.md @@ -24,33 +24,6 @@ Satori 的开发团队长期从事聊天机器人开发,熟悉各种聊天平 Zulip - - 这些适配器不仅为你带来了开箱即用的体验,也从实际上证明了 Satori 协议的通用性和扩展性。 不必担心使用 Satori 后会失去对聊天平台的控制。得益于 Satori 的内部接口机制,你完全可以大多数情况下编写通用代码,并在需要的时候使用内部接口来实现平台特定功能。 diff --git a/zh-CN/resources/guild.md b/zh-CN/resources/guild.md index 9dc3464..433c17c 100644 --- a/zh-CN/resources/guild.md +++ b/zh-CN/resources/guild.md @@ -40,7 +40,7 @@ | --- | --- | --- | | message_id | string | 请求 ID | | approve | boolean | 是否通过请求 | -| comment | string | 备注信息 | +| comment | string? | 备注信息 | 处理来自群组的邀请。