A Python wrapper for the Misskey API
Project description
MiPA
概要
MiPA はDiscord.py ライクな書き方ができるように作っている MisskeyApi wrapper です
注意
MiPACとの関係性について
MiPAはMiPACというライブラリに依存しています。これはMiPAのCore部分をまとめた物であり、基本的にはApiへのアクセス用メソッドなどを提供します。MiPAではMiPACのメソッド群をそのまま公開している為、MiPAC側で大きな変更が入るとMiPAを使用しているプロジェクトでもその影響を受ける可能性があります。そのため、CHANGELOG.md で MiPACのバージョンが変更された際はそのリリースノートへのリンクを添付しています。予めMiPAC側での変更を確認したうえでアップデートをお願いします。
- このプロジェクトは開発中です。仕様が定まっていないため、破壊的変更が多いです。
masterブランチで使用しているmipacはGitHubにあるmipacのdevelopブランチの物です。
サポートしているMisskey
Examples
import asyncio
from aiohttp import ClientWebSocketResponse
from mipac import Note
from mipac.models import ChatMessage
from mipa.ext.commands.bot import Bot
class MyBot(Bot):
def __init__(self):
super().__init__()
async def on_ready(self, ws: ClientWebSocketResponse):
await self.router.connect_channel(['main', 'home'])
print('Logged in ', self.user.username)
async def on_note(self, note: Note):
print(note.author.username, note.content)
async def on_chat(self, message: ChatMessage):
print(message.user.username, message.text)
if message.text == 'hello':
await self.client.chat.action.send(
f'hello! {message.user.username}',
user_id=message.user.id
)
if __name__ == '__main__':
bot = MyBot()
asyncio.run(bot.start('wss://example.com/streaming', 'your token here'))
Want more examples? Go to the examples folder! Want to know how to use a feature that isn't even here? Submit a request in an Issue!
使用者の方へ
MiPAで作ったBotなどをGitHubなどで公開している場合は、Issueなどに送信してくだされば、MiPAで作られている物に追加します。また、良ければBotのプロフィールなどにこのBotはMiPAで作成されているとの旨を記載してくださると嬉しいです。
MiPAで作られているもの
Bot
- akari
- 作者の yupix が作成しているBotです。クリーンアーキテクチャを用いているため、部分的に分かりにくい所があるかもしれません。
開発者向け情報
このプロジェクトでは blackのforkである、axblackを利用しています。主な違いはダブルクォートがデフォルトではなく、シングルクォートになっている点です
LICENSE
このプロジェクトは MIT LICENSE で提供されます。
MiPAでは多くの部分においてDiscord.pyを参考にさせていただきました。そのため、Discord.pyのソースコードを利用させていただいている個所ではファイルの初めにDiscord.py側のライセンスを明記しています。詳しくはコードを確認してください。
Special Thanks
- Discord.py
- Cogの仕組みやtask,stateの管理等多くの部分で参考にさせていただきました。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mipa-0.3.0.tar.gz.
File metadata
- Download URL: mipa-0.3.0.tar.gz
- Upload date:
- Size: 38.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ad381da03e31964f5d14518d6f8ffba16a9d920088c100190e117111744d515
|
|
| MD5 |
0d3d3bcdb5871b838d41b20f591521d5
|
|
| BLAKE2b-256 |
8f403493da09242893ed8b503fb87dc2f768447d6e142a910b99cc1bfac925e7
|
File details
Details for the file mipa-0.3.0-py3-none-any.whl.
File metadata
- Download URL: mipa-0.3.0-py3-none-any.whl
- Upload date:
- Size: 29.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5341072b44229d80585208ca030c360246fa97050e37068689c7a9be54b0b7bc
|
|
| MD5 |
c33db828f6c70b2b5c051634941bc2f3
|
|
| BLAKE2b-256 |
87ee0dca9db864f08dc72afdf19e67b14c311289d3206d92c84a58313131c79c
|