New Crowdin updates (#7046)
* New translations ja-JP.yml (German) * New translations ja-JP.yml (English) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Simplified) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations aiscript.md (German) * New translations theme.md (German) * New translations reaction.md (German) * New translations theme.md (German) * New translations theme.md (German) * New translations ja-JP.yml (German) * New translations theme.md (German) * New translations timelines.md (German) * New translations ja-JP.yml (German) * New translations mute.md (German) * New translations timelines.md (German) * New translations mute.md (German) * New translations reaction.md (German) * New translations pages.md (German) * New translations reaction.md (German) * New translations follow.md (German) * New translations pages.md (German) * New translations custom-emoji.md (German) * New translations follow.md (German) * New translations custom-emoji.md (English) * New translations deck.md (German) * New translations mfm.md (German) * New translations create-plugin.md (German) * New translations deck.md (German) * New translations create-plugin.md (German) * New translations create-plugin.md (English) * New translations create-plugin.md (German) * New translations keyboard-shortcut.md (German) * New translations keyboard-shortcut.md (German) * New translations create-plugin.md (German) * New translations keyboard-shortcut.md (German) * New translations create-plugin.md (German) * New translations create-plugin.md (German) * New translations reversi-bot.md (German) * New translations create-plugin.md (English) * New translations reversi-bot.md (English) * New translations create-plugin.md (German) * New translations reversi-bot.md (German) * New translations reversi-bot.md (German) * New translations stream.md (German) * New translations reversi-bot.md (English) * New translations reversi-bot.md (German) * New translations reversi-bot.md (German) * New translations reversi-bot.md (German) * New translations reversi-bot.md (English) * New translations reversi-bot.md (German) * New translations reversi-bot.md (English) * New translations reversi-bot.md (German) * New translations reversi-bot.md (German) * New translations reversi-bot.md (German) * New translations pages.md (Chinese Simplified) * New translations pages.md (Chinese Simplified) * New translations pages.md (Chinese Simplified) * New translations pages.md (Chinese Simplified) * New translations reaction.md (Chinese Simplified) * New translations reaction.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations ja-JP.yml (German) * New translations api.md (German) * New translations keyboard-shortcut.md (German) * New translations api.md (German) * New translations stream.md (German) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations ja-JP.yml (German) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations stream.md (German) * New translations ja-JP.yml (German) * New translations reversi-bot.md (German) * New translations stream.md (German) * New translations stream.md (German) * New translations stream.md (German) * New translations ja-JP.yml (Chinese Traditional) * New translations stream.md (German) * New translations ja-JP.yml (Chinese Traditional) * New translations stream.md (German) * New translations ja-JP.yml (Chinese Traditional) * New translations stream.md (German) * New translations ja-JP.yml (Chinese Traditional) * New translations stream.md (English) * New translations stream.md (German) * New translations ja-JP.yml (Chinese Traditional) * New translations stream.md (German) * New translations stream.md (German) * New translations stream.md (German) * New translations stream.md (English) * New translations stream.md (German) * New translations api.md (German) * New translations api.md (English) * New translations api.md (German) * New translations api.md (German) * New translations api.md (English) * New translations api.md (German) * New translations api.md (German) * New translations api.md (German) * New translations ja-JP.yml (Chinese Traditional) * New translations create-plugin.md (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations ja-JP.yml (Kabyle) * New translations ja-JP.yml (Korean) * New translations ja-JP.yml (Spanish) * New translations ja-JP.yml (Russian) * New translations ja-JP.yml (German) * New translations ja-JP.yml (English) * New translations ja-JP.yml (Chinese Simplified) * New translations ja-JP.yml (Polish) * New translations custom-emoji.md (Polish) * New translations mute.md (Polish) * New translations ja-JP.yml (Polish) * New translations ja-JP.yml (Polish) * New translations follow.md (Polish) * New translations ja-JP.yml (Polish) * New translations create-plugin.md (Polish) * New translations reaction.md (Polish) * New translations theme.md (Polish) * New translations timelines.md (Polish) * New translations ja-JP.yml (English) * New translations ja-JP.yml (Polish) * New translations ja-JP.yml (Polish) * New translations ja-JP.yml (Polish) * New translations aiscript.md (Polish) * New translations keyboard-shortcut.md (Polish) * New translations pages.md (Polish) * New translations reversi-bot.md (Polish) * New translations stream.md (Polish) * New translations theme.md (Polish) * New translations ja-JP.yml (Polish) * New translations timelines.md (Polish) * New translations deck.md (Polish) * New translations ja-JP.yml (Indonesian) * New translations aiscript.md (Indonesian) * New translations api.md (Indonesian) * New translations create-plugin.md (Indonesian) * New translations custom-emoji.md (Indonesian) * New translations follow.md (Indonesian) * New translations keyboard-shortcut.md (Indonesian) * New translations mute.md (Indonesian) * New translations pages.md (Indonesian) * New translations reaction.md (Indonesian) * New translations reversi-bot.md (Indonesian) * New translations stream.md (Indonesian) * New translations theme.md (Indonesian) * New translations timelines.md (Indonesian) * New translations deck.md (Indonesian) * New translations mfm.md (Indonesian) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Indonesian) * New translations keyboard-shortcut.md (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations reaction.md (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations mute.md (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations custom-emoji.md (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations ja-JP.yml (Indonesian)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# 页面
|
||||
|
||||
## 变量
|
||||
您可以使用变量创建动态页面。您可以在文本中使用<b>{变量名}</b>的格式来引用变量的值。例えば <b>Hello { thing } world!</b> というテキストで、変数(thing)の値が <b>ai</b> だった場合、テキストは <b>Hello ai world!</b> になります。
|
||||
您可以使用变量创建动态页面。您可以在文本中使用<b>{变量名}</b>的格式来引用变量的值。例如当变量(thing)的值为<b>ai</b>时,字符串<b>Hello { thing } world!</b>的值为<b>Hello ai world!</b>。
|
||||
|
||||
変数の評価(値を算出すること)は上から下に行われるので、ある変数の中で自分より下の変数を参照することはできません。例えば上から <b>A、B、C</b> と3つの変数を定義したとき、<b>C</b>の中で<b>A</b>や<b>B</b>を参照することはできますが、<b>A</b>の中で<b>B</b>や<b>C</b>を参照することはできません。
|
||||
变量的处理(计算变量的值)是从上到下执行的,因此不能引用未声明的变量。例如,如果您依次定义了<b> A,B,C </b>三个变量,则在<b> C </b>中可以引用<b> A </b>和<b> B </b>,但<b> A </b>中不能引用<b> B </b>或<b> C </b>。
|
||||
|
||||
ユーザーからの入力を受け取るには、ページに「ユーザー入力」ブロックを設置し、「変数名」に入力を格納したい変数名を設定します(変数は自動で作成されます)。その変数を使ってユーザー入力に応じた動作を行えます。
|
||||
为了接收来自用户的输入,页面上设有“用户输入”块,在“变量名称”中设置要在其中保存输入值的变量名(变量会自动创建)。然后您可以通过该变量使用用户输入的值进行其他操作。
|
||||
|
||||
関数を使うと、値の算出処理を再利用可能な形にまとめることができます。関数を作るには、「関数」タイプの変数を作成します。関数にはスロット(引数)を設定することができ、スロットの値は関数内で変数として利用可能です。また、関数を引数に取る関数(高階関数と呼ばれます)も存在します。関数は予め定義しておくほかに、このような高階関数のスロットに即席でセットすることもできます。
|
||||
函数时一种将可重用的计算过程组合起来的形式。要创建函数,请创建“函数”类型的变量。可以为函数设置插槽(参数),并且插槽值可以作为函数内的变量使用。另外,也可以将函数作为函数的参数(称为高阶函数)。除了预定义函数外,您也可以随时将函数定义在这类高阶功能的插槽中。
|
||||
|
@@ -1,11 +1,11 @@
|
||||
# 回应
|
||||
他の人のノートに、絵文字を付けて簡単にあなたの反応を伝えられる機能です。 リアクションするには、ノートの + アイコンをクリックしてピッカーを表示し、絵文字を選択します。 リアクションには[カスタム絵文字](./custom-emoji)も使用できます。
|
||||
通过将表情符号加到其他人的帖子上,您可以快速表达您的反应。 要做出回应,请单击帖子上的 + 图标以打开选择器并选择一个表情符号。 您也可以使用[自定义表情符号](./custom-emoji)来进行回应。
|
||||
|
||||
## リアクションピッカーのカスタマイズ
|
||||
ピッカーに表示される絵文字を自分好みにカスタマイズすることができます。 設定の「リアクション」で設定します。
|
||||
## 自定义回应选择器
|
||||
您可以根据自己的喜好自定义选择器中显示的表情符号。 在设置的“回应”中即可进行设置。
|
||||
|
||||
## リモート投稿へのリアクションについて
|
||||
リアクションはMisskeyオリジナルの機能であるため、リモートインスタンスがMisskeyでない限りは、ほとんどの場合「Like」としてアクティビティが送信されます。一般的にはLikeは「お気に入り」として実装されているようです。 また、相手がMisskeyであったとしても、カスタム絵文字リアクションは伝わらず、自動的に「👍」等にフォールバックされます。
|
||||
## 关于对外部发帖的回应
|
||||
回应是Misskey的原生功能,因此,除非外部实例是Misskey,否则该操作很有可能仅以“Like”的形式发送。通常,Like表现为“点赞”的功能。 另外,即使对方同样是Misskey,自定义表情符号的回应也不会被发送,而是会自动显示为“👍”等表情符号。
|
||||
|
||||
## リモートからのリアクションについて
|
||||
リモートから「Like」アクティビティを受信したとき、Misskeyでは「👍」のリアクションとして解釈されます。
|
||||
## 关于外部回应
|
||||
当从外部接收到“Like”操作时,Misskey会将其解释为“👍”回应。
|
||||
|
@@ -1,33 +1,33 @@
|
||||
# MisskeyリバーシBotの開発
|
||||
Misskeyのリバーシ機能に対応したBotの開発方法をここに記します。
|
||||
# Misskey的黑白棋Bot开发
|
||||
本页会说明如何为Misskey的黑白棋功能开发一个Bot机器人。
|
||||
|
||||
1. `games/reversi`ストリームに以下のパラメータを付けて接続する:
|
||||
* `i`: botアカウントのAPIキー
|
||||
1. 使用以下参数来连接`games/reversi`流式API:
|
||||
* `i`: bot账号的API key
|
||||
|
||||
2. 対局への招待が来たら、ストリームから`invited`イベントが流れてくる
|
||||
* イベントの中身に、`parent`という名前で対局へ誘ってきたユーザーの情報が含まれている
|
||||
2. 当出现对局邀请时,流中会触发`invited`事件
|
||||
* 事件内容中包含邀请您参加游戏的用户信息,名字为`parent`。
|
||||
|
||||
3. `games/reversi/match`へ、`user_id`として`parent`の`id`が含まれたリクエストを送信する
|
||||
3. 向`games/reversi/match`发送请求,其中`user_id`包含`parent`的`id`
|
||||
|
||||
4. 上手くいくとゲーム情報が返ってくるので、`games/reversi-game`ストリームへ、以下のパラメータを付けて接続する:
|
||||
* `i`: botアカウントのAPIキー
|
||||
* `game`: `game`の`id`
|
||||
4. 请求成功时将返回游戏信息,然后可以使用以下参数连接到`games/reversi-game`流:
|
||||
* `i`: bot账号的API key
|
||||
* `game`: `game`的`id`
|
||||
|
||||
5. この間、相手がゲームの設定を変更するとその都度`update-settings`イベントが流れてくるので、必要であれば何かしらの処理を行う
|
||||
5. 与此同时,每次对手更改游戏设置时,都会触发`update-settings`事件,如果有必要的话,需要对其进行处理。
|
||||
|
||||
6. 設定に満足したら、`{ type: 'accept' }`メッセージをストリームに送信する
|
||||
6. 一旦符合设置,则向流发送`{ type: 'accept' }`消息
|
||||
|
||||
7. ゲームが開始すると、`started`イベントが流れてくる
|
||||
* イベントの中身にはゲーム情報が含まれている
|
||||
7. 游戏开始时会触发`started`事件
|
||||
* 游戏状态信息会包含在该事件中
|
||||
|
||||
8. 石を打つには、ストリームに`{ type: 'set', pos: <位置> }`を送信する(位置の計算方法は後述)
|
||||
8. 要放置棋子,向流发送`{ type: 'set', pos: <位置> }`(后面会说明位置的计算方法)
|
||||
|
||||
9. 相手または自分が石を打つと、ストリームから`set`イベントが流れてくる
|
||||
* `color`として石の色が含まれている
|
||||
* `pos`として位置情報が含まれている
|
||||
9. 当对方或者您放置棋子时,会触发`set`事件
|
||||
* `color`中包含该棋子的颜色
|
||||
* `pos`中包含该棋子的位置
|
||||
|
||||
## 位置の計算法
|
||||
8x8のマップを考える場合、各マスの位置(インデックスと呼びます)は次のようになっています:
|
||||
## 位置计算方法
|
||||
当棋盘尺寸为8x8时,每个方格的位置(称为索引)如下所示:
|
||||
```
|
||||
+--+--+--+--+--+--+--+--+
|
||||
| 0| 1| 2| 3| 4| 5| 6| 7|
|
||||
@@ -38,29 +38,29 @@ Misskeyのリバーシ機能に対応したBotの開発方法をここに記し
|
||||
...
|
||||
```
|
||||
|
||||
### X,Y座標 から インデックス に変換する
|
||||
### 从X,Y坐标转换为索引
|
||||
```
|
||||
pos = x + (y * mapWidth)
|
||||
```
|
||||
`mapWidth`は、ゲーム情報の`map`から、次のようにして計算できます:
|
||||
`mapWidth`可以根据游戏信息中的`map`,通过如下方法计算出来:
|
||||
```
|
||||
mapWidth = map[0].length
|
||||
```
|
||||
|
||||
### インデックス から X,Y座標 に変換する
|
||||
### 从索引转换为X,Y坐标
|
||||
```
|
||||
x = pos % mapWidth
|
||||
y = Math.floor(pos / mapWidth)
|
||||
```
|
||||
|
||||
## マップ情報
|
||||
マップ情報は、ゲーム情報の`map`に入っています。 文字列の配列になっており、ひとつひとつの文字がマス情報を表しています。 それをもとにマップのデザインを知る事が出来ます:
|
||||
* `(スペース)` ... マス無し
|
||||
* `-` ... マス
|
||||
* `b` ... 初期配置される黒石
|
||||
* `w` ... 初期配置される白石
|
||||
## 棋盘信息
|
||||
棋盘信息包含在游戏信息的`map`中。 它是一个字符串数组,每个字符代表一块格子的信息。 您可以根据这些来了解地图如何设计:
|
||||
* `(空)` ... 没有格子
|
||||
* `-` ... 格子
|
||||
* `b` ... 黑子先下
|
||||
* `w` ... 白子先下
|
||||
|
||||
例えば、4*4の次のような単純なマップがあるとします:
|
||||
以下面这个4*4的简单棋盘为例:
|
||||
```text
|
||||
+---+---+---+---+
|
||||
| | | | |
|
||||
@@ -73,23 +73,23 @@ y = Math.floor(pos / mapWidth)
|
||||
+---+---+---+---+
|
||||
```
|
||||
|
||||
この場合、マップデータはこのようになります:
|
||||
这种情况下,棋盘数据是这样的:
|
||||
```javascript
|
||||
['----', '-wb-', '-bw-', '----']
|
||||
```
|
||||
|
||||
## ユーザーにフォームを提示して対話可能Botを作成する
|
||||
ユーザーとのコミュニケーションを行うため、ゲームの設定画面でユーザーにフォームを提示することができます。 例えば、Botの強さをユーザーが設定できるようにする、といったシナリオが考えられます。
|
||||
## 能和用户互动的交互式Bot机器人的创建
|
||||
要和用户交互,您可以在游戏设置屏幕上向用户显示对话框。 例如,可以让用户选择Bot机器人的难度。
|
||||
|
||||
フォームを提示するには、`reversi-game`ストリームに次のメッセージを送信します:
|
||||
要显示提示框,需要向`reversi-game`流发送下列消息:
|
||||
```javascript
|
||||
{
|
||||
type: 'init-form',
|
||||
body: [フォームコントロールの配列]
|
||||
body: [表单控件数组]
|
||||
}
|
||||
```
|
||||
|
||||
フォームコントロールの配列については今から説明します。 フォームコントロールは、次のようなオブジェクトです:
|
||||
下面说明表单控件数组的结构。 表单控件指的是如下面所示的对象:
|
||||
```javascript
|
||||
{
|
||||
id: 'switch1',
|
||||
@@ -98,10 +98,10 @@ y = Math.floor(pos / mapWidth)
|
||||
value: false
|
||||
}
|
||||
```
|
||||
`id` ... コントロールのID。 `type` ... コントロールの種類。後述します。 `label` ... コントロールと一緒に表記するテキスト。 `value` ... コントロールのデフォルト値。
|
||||
`id` ... 控件ID。 `type` ... 控件类型。说明详见后文。 `label` ... 控件元素上显示的文字。 `value` ... 控件元素的默认值。
|
||||
|
||||
### フォームの操作を受け取る
|
||||
ユーザーがフォームを操作すると、ストリームから`update-form`イベントが流れてきます。 イベントの中身には、コントロールのIDと、ユーザーが設定した値が含まれています。 例えば、上で示したスイッチをユーザーがオンにしたとすると、次のイベントが流れてきます:
|
||||
### 控件行为的处理
|
||||
当用户与对话框交互时将会触发流的`update-form`事件。 事件的内容包含控件的ID和用户设置的值。 例如,如果用户将上面显示的开关控件打开,则将触发以下事件:
|
||||
```javascript
|
||||
{
|
||||
id: 'switch1',
|
||||
@@ -109,18 +109,18 @@ y = Math.floor(pos / mapWidth)
|
||||
}
|
||||
```
|
||||
|
||||
### フォームコントロールの種類
|
||||
### 表单控件的类型
|
||||
#### 开关
|
||||
type: `switch` スイッチを表示します。何かの機能をオン/オフさせたい場合に有用です。
|
||||
type: `switch` 显示一个开关。当您想要打开/关闭某些功能时非常有用。
|
||||
|
||||
##### プロパティ
|
||||
`label` ... スイッチに表記するテキスト。
|
||||
##### 属性
|
||||
`label` ... 开关上显示的文字。
|
||||
|
||||
#### ラジオボタン
|
||||
type: `radio` ラジオボタンを表示します。選択肢を提示するのに有用です。例えば、Botの強さを設定させるなどです。
|
||||
#### 单选按钮
|
||||
type: `radio` 显示一个单选按钮。用来表示单项选择。例如,可以选择Bot机器人的难度。
|
||||
|
||||
##### プロパティ
|
||||
`items` ... ラジオボタンの選択肢。例:
|
||||
##### 属性
|
||||
`items` ... 单元按钮的选择项。例:
|
||||
```javascript
|
||||
items: [{
|
||||
label: '弱',
|
||||
@@ -129,32 +129,32 @@ items: [{
|
||||
label: '中',
|
||||
value: 2
|
||||
}, {
|
||||
label: '強',
|
||||
label: '强',
|
||||
value: 3
|
||||
}]
|
||||
```
|
||||
|
||||
#### スライダー
|
||||
type: `slider` スライダーを表示します。
|
||||
#### 滑块
|
||||
type: `slider` 显示一个滑块。
|
||||
|
||||
##### プロパティ
|
||||
`min` ... スライダーの下限。 `max` ... スライダーの上限。 `step` ... 入力欄で刻むステップ値。
|
||||
##### 属性
|
||||
`min` ... 滑块最小值。 `max` ... 滑块最大值。 `step` ... 滑块值的步长。
|
||||
|
||||
#### テキストボックス
|
||||
type: `textbox` テキストボックスを表示します。ユーザーになにか入力させる一般的な用途に利用できます。
|
||||
#### 文本框
|
||||
type: `textbox` 显示一个文本框。可以在各种需要用户输入的地方使用。
|
||||
|
||||
## ユーザーにメッセージを表示する
|
||||
設定画面でユーザーと対話する、フォーム以外のもうひとつの方法がこれです。ユーザーになにかメッセージを表示することができます。 例えば、ユーザーがBotの対応していないモードやマップを選択したとき、警告を表示するなどです。 メッセージを表示するには、次のメッセージをストリームに送信します:
|
||||
## 向用户显示消息
|
||||
设置屏幕上与用户交互,是除了对话框外的另一种方法。您可以向用户显示一条消息。 例如,当用户选择Bot机器人不支持的模式或棋盘时显示警告。 要显示消息,请将以下消息发送到流:
|
||||
```javascript
|
||||
{
|
||||
type: 'message',
|
||||
body: {
|
||||
text: 'メッセージ内容',
|
||||
type: 'メッセージの種類'
|
||||
text: '消息内容',
|
||||
type: '消息类型'
|
||||
}
|
||||
}
|
||||
```
|
||||
メッセージの種類: `success`, `info`, `warning`, `error`。
|
||||
消息类型:`success`, `info`, `warning`, `error`。
|
||||
|
||||
## 投了する
|
||||
投了をするには、<a href="./api/endpoints/games/reversi/games/surrender">このエンドポイント</a>にリクエストします。
|
||||
## 认输
|
||||
要认输,请发送请求到这个终端。
|
||||
|
@@ -1,25 +1,25 @@
|
||||
# 流式API
|
||||
|
||||
ストリーミングAPIを使うと、リアルタイムで様々な情報(例えばタイムラインに新しい投稿が流れてきた、メッセージが届いた、フォローされた、など)を受け取ったり、様々な操作を行ったりすることができます。
|
||||
通过流式API,您可以实时接收各种信息(例如,你的时间线中的新帖文,收到的消息,关注等),并进行各种操作。
|
||||
|
||||
## ストリームに接続する
|
||||
## 连接到流
|
||||
|
||||
ストリーミングAPIを利用するには、まずMisskeyサーバーに**websocket**接続する必要があります。
|
||||
要使用流式API,您需要使用**websocket**连接到Misskey服务器。
|
||||
|
||||
以下のURLに、`i`というパラメータ名で認証情報を含めて、websocket接続してください。例:
|
||||
请使用参数`i`连接到以下URL,并在websocket连接中包含认证信息。例如:
|
||||
```
|
||||
%WS_URL%/streaming?i=xxxxxxxxxxxxxxx
|
||||
```
|
||||
|
||||
認証情報は、自分のAPIキーや、アプリケーションからストリームに接続する際はユーザーのアクセストークンのことを指します。
|
||||
认证信息是您的API密钥,从应用程序连接到流时需要引用的用户访问令牌
|
||||
|
||||
<div class="ui info">
|
||||
<p><i class="fas fa-info-circle"></i> 認証情報の取得については、<a href="./api">こちらのドキュメント</a>をご確認ください。</p>
|
||||
<p><i class="fas fa-info-circle"></i> 关于如何获取认证信息,请参考<a href="./api">此文档</a>。</p>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
認証情報は省略することもできますが、その場合非ログインでの利用ということになり、受信できる情報や可能な操作は限られます。例:
|
||||
您可以省略身份验证信息。此时无需登录即可使用,但是可以接收的信息和可以执行的操作将受到限制。例:
|
||||
|
||||
```
|
||||
%WS_URL%/streaming
|
||||
@@ -27,15 +27,15 @@
|
||||
|
||||
---
|
||||
|
||||
ストリームに接続すると、後述するAPI操作や、投稿の購読を行ったりすることができます。 しかしまだこの段階では、例えばタイムラインへの新しい投稿を受信したりすることはできません。 それを行うには、ストリーム上で、後述する**チャンネル**に接続する必要があります。
|
||||
通过连接到流,您可以执行后文所示的API操作并订阅帖子。 但是此时例如时间线上的新帖子等还无法接收到。 要实现此功能,您需要连接到后文所述的流的**频道**。
|
||||
|
||||
**ストリームでのやり取りはすべてJSONです。**
|
||||
**所有流交互都是JSON格式。**
|
||||
|
||||
## 频道
|
||||
MisskeyのストリーミングAPIにはチャンネルという概念があります。これは、送受信する情報を分離するための仕組みです。 Misskeyのストリームに接続しただけでは、まだリアルタイムでタイムラインの投稿を受信したりはできません。 ストリーム上でチャンネルに接続することで、様々な情報を受け取ったり情報を送信したりすることができるようになります。
|
||||
频道是Misskey的流API中的概念。这是一种分离发送和接收信息的机制。 您无法仅通过连接到Misskey流来实时接收时间线帖子。 需要通过连接到流中的频道,您才能够接收和发送各种消息。
|
||||
|
||||
### チャンネルに接続する
|
||||
チャンネルに接続するには、次のようなデータをJSONでストリームに送信します:
|
||||
### 连接到频道
|
||||
要连接到频道,请将JSON数据发送到流:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -50,19 +50,19 @@ MisskeyのストリーミングAPIにはチャンネルという概念があり
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
* `channel`には接続したいチャンネル名を設定します。チャンネルの種類については後述します。
|
||||
* `id`にはそのチャンネルとやり取りするための任意のIDを設定します。ストリームでは様々なメッセージが流れるので、そのメッセージがどのチャンネルからのものなのか識別する必要があるからです。このIDは、UUIDや、乱数のようなもので構いません。
|
||||
* `params`はチャンネルに接続する際のパラメータです。チャンネルによって接続時に必要とされるパラメータは異なります。パラメータ不要のチャンネルに接続する際は、このプロパティは省略可能です。
|
||||
其中:
|
||||
* `channel`中可以设置您要连接的频道名。频道类型将在后面说明。
|
||||
* `id`设置用于与频道通信的ID。因为流中有着各种消息,因此需要确定消息来自哪个频道。该ID可以是UUID或随机数。
|
||||
* `params`是连接到频道时传的参数。连接不同的频道时需要不同的参数。连接到无需参数的频道时,该属性为可选。
|
||||
|
||||
<div class="ui info">
|
||||
<p><i class="fas fa-info-circle"></i> IDはチャンネルごとではなく「チャンネルの接続ごと」です。なぜなら、同じチャンネルに異なるパラメータで複数接続するケースもあるからです。</p>
|
||||
<p><i class="fas fa-info-circle"></i> ID对应的是“频道的连接”,而不是频道。因为在某些情况下会使用不同的参数对同一频道进行多个连接。</p>
|
||||
</div>
|
||||
|
||||
### チャンネルからのメッセージを受け取る
|
||||
例えばタイムラインのチャンネルなら、新しい投稿があった時にメッセージを発します。そのメッセージを受け取ることで、タイムラインに新しい投稿がされたことをリアルタイムで知ることができます。
|
||||
### 从频道接收消息
|
||||
例如,当有新帖子时,时间线的频道将发送一条消息。通过接收此消息,您可以实时知道时间线上有新帖子。
|
||||
|
||||
チャンネルがメッセージを発すると、次のようなデータがJSONでストリームに流れてきます:
|
||||
当频道发出消息时,以下数据将以JSON格式传输到流中:
|
||||
```json
|
||||
{
|
||||
type: 'channel',
|
||||
@@ -76,15 +76,15 @@ MisskeyのストリーミングAPIにはチャンネルという概念があり
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
* `id`には前述したそのチャンネルに接続する際に設定したIDが設定されています。これで、このメッセージがどのチャンネルからのものなのか知ることができます。
|
||||
* `type`にはメッセージの種類が設定されます。チャンネルによって、どのような種類のメッセージが流れてくるかは異なります。
|
||||
* `body`にはメッセージの内容が設定されます。チャンネルによって、どのような内容のメッセージが流れてくるかは異なります。
|
||||
其中:
|
||||
* `id`为前文所述连接到频道时所设置的ID。因此可以知道此消息来自哪个频道。
|
||||
* `type`为所设的消息类型。不同的频道会有不同类型的消息。
|
||||
* `body`为所设的消息内容。不同的频道中的消息内容也会有不同。
|
||||
|
||||
### チャンネルに向けてメッセージを送信する
|
||||
チャンネルによっては、メッセージを受け取るだけでなく、こちらから何かメッセージを送信し、何らかの操作を行える場合があります。
|
||||
### 向频道发送消息
|
||||
根据频道的不同,您不仅可以接收消息,而且还可以发送消息并执行某些操作。
|
||||
|
||||
チャンネルにメッセージを送信するには、次のようなデータをJSONでストリームに送信します:
|
||||
要将消息发送到频道,请将JSON格式数据发送到流:
|
||||
```json
|
||||
{
|
||||
type: 'channel',
|
||||
@@ -98,13 +98,13 @@ MisskeyのストリーミングAPIにはチャンネルという概念があり
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
* `id`には前述したそのチャンネルに接続する際に設定したIDを設定します。これで、このメッセージがどのチャンネルに向けたものなのか識別させることができます。
|
||||
* `type`にはメッセージの種類を設定します。チャンネルによって、どのような種類のメッセージを受け付けるかは異なります。
|
||||
* `body`にはメッセージの内容を設定します。チャンネルによって、どのような内容のメッセージを受け付けるかは異なります。
|
||||
其中:
|
||||
* `id`为前文所述连接到频道时想要设置的ID。因此您可以决定此消息发送到哪个频道。
|
||||
* `type`为想要设置的消息类型。不同的频道会接受不同类型的消息。
|
||||
* `body`为想要设置的消息内容。不同的频道接受的消息内容也会不同。
|
||||
|
||||
### チャンネルから切断する
|
||||
チャンネルから切断するには、次のようなデータをJSONでストリームに送信します:
|
||||
### 断开频道连接
|
||||
要断开与频道的连接,请将JSON格式数据发送到流:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -115,8 +115,8 @@ MisskeyのストリーミングAPIにはチャンネルという概念があり
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
* `id`には前述したそのチャンネルに接続する際に設定したIDを設定します。
|
||||
其中:
|
||||
* `id`为前文所述连接到频道时想要设置的ID。
|
||||
|
||||
## ストリームを経由してAPIリクエストする
|
||||
|
||||
@@ -136,7 +136,7 @@ MisskeyのストリーミングAPIにはチャンネルという概念があり
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
其中:
|
||||
* `id`には、APIのレスポンスを識別するための、APIリクエストごとの一意なIDを設定する必要があります。UUIDや、簡単な乱数のようなもので構いません。
|
||||
* `endpoint`には、あなたがリクエストしたいAPIのエンドポイントを指定します。
|
||||
* `data`には、エンドポイントのパラメータを含めます。
|
||||
@@ -158,7 +158,7 @@ APIへリクエストすると、レスポンスがストリームから次の
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
其中:
|
||||
* `xxxxxxxxxxxxxxxx`の部分には、リクエストの際に設定された`id`が含まれています。これにより、どのリクエストに対するレスポンスなのか判別することができます。
|
||||
* `body`には、レスポンスが含まれています。
|
||||
|
||||
@@ -185,7 +185,7 @@ Misskeyは投稿のキャプチャと呼ばれる仕組みを提供していま
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
其中:
|
||||
* `id`にキャプチャしたい投稿の`id`を設定します。
|
||||
|
||||
このメッセージを送信すると、Misskeyにキャプチャを要請したことになり、以後、その投稿に関するイベントが流れてくるようになります。
|
||||
@@ -206,7 +206,7 @@ Misskeyは投稿のキャプチャと呼ばれる仕組みを提供していま
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
其中:
|
||||
* `body`内の`id`に、イベントを発生させた投稿のIDが設定されます。
|
||||
* `body`内の`type`に、イベントの種類が設定されます。
|
||||
* `body`内の`body`に、イベントの詳細が設定されます。
|
||||
@@ -219,7 +219,7 @@ Misskeyは投稿のキャプチャと呼ばれる仕組みを提供していま
|
||||
* `reaction`に、リアクションの種類が設定されます。
|
||||
* `userId`に、リアクションを行ったユーザーのIDが設定されます。
|
||||
|
||||
例:
|
||||
例:
|
||||
```json
|
||||
{
|
||||
type: 'noteUpdated',
|
||||
@@ -239,7 +239,7 @@ Misskeyは投稿のキャプチャと呼ばれる仕組みを提供していま
|
||||
|
||||
* `deletedAt`に、削除日時が設定されます。
|
||||
|
||||
例:
|
||||
例:
|
||||
```json
|
||||
{
|
||||
type: 'noteUpdated',
|
||||
@@ -259,7 +259,7 @@ Misskeyは投稿のキャプチャと呼ばれる仕組みを提供していま
|
||||
* `choice`に、選択肢IDが設定されます。
|
||||
* `userId`に、投票を行ったユーザーのIDが設定されます。
|
||||
|
||||
例:
|
||||
例:
|
||||
```json
|
||||
{
|
||||
type: 'noteUpdated',
|
||||
@@ -289,7 +289,7 @@ Misskeyは投稿のキャプチャと呼ばれる仕組みを提供していま
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
其中:
|
||||
* `id`にキャプチャを解除したい投稿の`id`を設定します。
|
||||
|
||||
このメッセージを送信すると、以後、その投稿に関するイベントは流れてこないようになります。
|
||||
|
Reference in New Issue
Block a user