An open API service indexing awesome lists of open source software.

https://github.com/ekkx/yaylib

nanameue, Inc. Yay! (イェイ) - API ライブラリ 🛠️
https://github.com/ekkx/yaylib

api automation bot client framework library nanameue python sdk wrapper yay

Last synced: 21 days ago
JSON representation

nanameue, Inc. Yay! (イェイ) - API ライブラリ 🛠️

Awesome Lists containing this project

README

          

yaylib

### yaylib

**好きでつながるバーチャルワールド - Yay! の API ライブラリ**

Go 
TypeScript 
Python 
Rust

あらゆる操作の自動化や、ボットの開発が可能です。

Discord に参加

Yay! の API を [Go](https://github.com/ekkx/yaylib) / [TypeScript](https://github.com/ekkx/yaylib/tree/master/packages/typescript) / [Python](https://github.com/ekkx/yaylib/tree/master/packages/python) / [Rust](https://github.com/ekkx/yaylib/tree/master/packages/rust) から扱うための非公式 SDK です。

### インストール

```sh
go get github.com/ekkx/yaylib/v2 # Go
npm install yaylib # TypeScript
pip install yaylib # Python
cargo add yaylib # Rust
```

### クイックスタート (Go)

```go
package main

import (
"context"

"github.com/ekkx/yaylib/v2"
)

func main() {
ctx := context.Background()
client := yaylib.NewClient()

// ログイン(セッションは透過的にキャッシュされます)
client.LoginWithEmail(ctx).Email("...").Password("...").Execute()

// タイムラインを取得
tl, _, _ := client.GetTimeline(ctx, yaylib.NoreplyModeFalse).Number(20).Execute()
_ = tl

// 投稿する
client.CreatePost(ctx).
XJwt(client.GenerateXJwt()).
PostType("text").
Text("hello from yaylib").
Execute()
}
```

すべてのオペレーションは `client.` として直接呼び出せます。

### イベントストリーム

```go
stream, _ := client.OpenEventStream(ctx)
sub, _ := stream.Subscribe(ctx, yaylib.ChatRoomChannel())

for ev := range sub.Events() {
switch e := ev.(type) {
case *yaylib.NewMessageEvent:
// 新着メッセージを受信
fmt.Println("new message:", e)
}
}
```

### サンプル

実行できるサンプルを [`examples/`](https://github.com/ekkx/yaylib/tree/master/examples/go) に用意しています(全言語共通)。

- 認証 + タイムライン取得
- テキスト投稿
- イベントストリームの簡単なボット
- セッション永続化とエラー処理

```bash
YAY_EMAIL=... YAY_PASSWORD=... go run ./examples/go/timeline
```

### ⚖️ ライセンス






MIT © ekkx