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: 12 days ago
JSON representation

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

Awesome Lists containing this project

README

          












Logo

yaylib



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

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





Node.js 版はこちらから »





ドキュメント
·
バグを報告
·
Discord に参加


## [](https://github.com/ekkx) Installation

**yaylib** は `pip` コマンドからインストールします。

```shell
pip install yaylib
```

> [!TIP]
> 動作条件は `Python 3.10` 以上からです。


## [](https://github.com/ekkx) Quick Example

#### ✨ 投稿を作成する

```python
import yaylib

bot = yaylib.Client()
bot.login('your_email', 'your_password')

bot.create_post('Hello with yaylib!')
```

#### ✨ タイムラインを取得する

```python
import yaylib

bot = yaylib.Client()

timeline = bot.get_timeline(number=100)

for post in timeline.posts:
print(post.user.nickname) # 投稿者名
print(post.text) # 本文
print(post.likes_count) # いいね数
print(post.reposts_count) # (´∀`∩)↑age↑の数
print(post.in_reply_to_post_count) # 返信の数
```

#### ✨ タイムラインをキーワードで検索して「いいね」する

```python
import yaylib

bot = yaylib.Client()
bot.login('your_email', 'your_password')

timeline = bot.get_timeline_by_keyword(
keyword='プログラミング',
number=15
)

for post in timeline.posts:
bot.like(post.id)
```

#### ✨ 画像と一緒に投稿を作成する

```python
import yaylib

bot = yaylib.Client()
bot.login('your_email', 'your_password')

# 画像のパスを指定
image_paths = [
'./test1.jpg',
'./test2.jpg',
'./test3.jpg',
]

# 画像の使い道を指定
image_type = yaylib.ImageType.POST

# サーバー上にアップロード
attachments = bot.upload_image(image_paths, image_type)

# サーバー上のファイル名を指定する
# attachmentsが一つ飛ばしなのはオリジナル品質の画像のみを指定するため
bot.create_post(
'Hello with yaylib!',
attachment_filename=attachments[0].filename,
attachment_2_filename=attachments[2].filename,
attachment_3_filename=attachments[4].filename,
)
```

#### ✨ 新規ユーザーをフォローする

```python
import yaylib

bot = yaylib.Client()
bot.login('your_email', 'your_password')

new_users = bot.search_users(recently_created=True)

for new_user in new_users.users:
bot.follow_user(new_user.id)
```

#### ✨ リアルタイムでチャットを取得する

```python
import yaylib

class ChatBot(yaylib.Client):
async def on_ready():
print('Botがオンラインになりました!')

async def on_chat_request(self, total_count):
# チャットリクエストを承認し on_message() に送信する
chat_requests = await self.chat.get_chat_requests()
for chat_room in chat_requests.chat_rooms:
await self.chat.accept_chat_requests(chat_room_ids=[chat_room.id])
message = await self.chat.get_messages(chat_requests.chat_rooms[0].id)
await self.on_message(message[0])

async def on_message(self, message: yaylib.Message):
if message.text == 'ping':
await self.chat.send_message(
message.room_id,
text='pong',
)

async def on_chat_delete(self, room_id):
print(f'チャットルームが削除されました。{room_id}')

intents = yaylib.Intents.none()
intents.chat_message = True

bot = ChatBot(intents=intents)
bot.run('your_email', 'your_password')
```

より詳しい使用例については、[ドキュメント](https://ekkx.github.io/yaylib/demo.html)を参照してください。


## 👑 yaylib で誕生したロボットたち

「yaylib」を用いて開発したロボットがある場合は、ぜひ教えてください!



MindReader AI
めいく
GIGAZINE








開発者: 毛の可能性







開発者: まぐ







開発者: ぺゅー





## 🤝 共同開発について

詳しい **yaylib** の開発参加手順については、[こちら](https://github.com/ekkx/yaylib/blob/develop/CONTRIBUTING.md)を参照してください。


## 📜 免責事項

yaylib は、API の公式なサポートやメンテナンスを提供するものではありません。このクライアントを使用する場合、**利用者はリスクや責任を自己負担できるもの**とします。このクライアントによって提供される情報やデータの正確性、信頼性、完全性、適時性について、いかなる保証も行いません。また、このクライアントの使用によって生じた損害や不利益について、一切の責任を負いかねます。利用者は自己の責任において、このクライアントを使用し、API にアクセスするものとします。なお、この免責事項は予告なく変更される場合があります。


## ⚖️ ライセンス






MIT © ekkx

フルライセンスは [こちら](https://github.com/ekkx/yaylib/blob/master/LICENSE) からご確認いただけます。
このプロジェクトは、 **【MIT ライセンス】** の条件の下でライセンスされています。

(トップに戻る)