Skip to main content

A Python wrapper for the Misskey API

Project description

MiPA

Discord server invite Code style: black

概要

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側のライセンスを明記しています。詳しくはコードを確認してください。

FOSSA Status

Special Thanks

  • Discord.py
    • Cogの仕組みやtask,stateの管理等多くの部分で参考にさせていただきました。

Documentation * Discord Server

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mipa-0.2.3.tar.gz (38.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mipa-0.2.3-py3-none-any.whl (29.7 kB view details)

Uploaded Python 3

File details

Details for the file mipa-0.2.3.tar.gz.

File metadata

  • Download URL: mipa-0.2.3.tar.gz
  • Upload date:
  • Size: 38.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for mipa-0.2.3.tar.gz
Algorithm Hash digest
SHA256 69ad0878156875a050bc374785e657def82350a65e500a6e57533e2db7d1cf8f
MD5 c16a837364b0f53ffe1ad5a31d7324b2
BLAKE2b-256 e2175f7fee608be80b4ca061f43cbabecc69491a6d51a8545c7494492030210f

See more details on using hashes here.

File details

Details for the file mipa-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: mipa-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 29.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for mipa-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bff78127bf14ceb9cd5231ca5b48238910b07f161cbea4ddf29b5b8fdd983ca0
MD5 ad1b22d4cd04a4d51bdf28226acae77a
BLAKE2b-256 8a30c7d00b2a104154c6a4d58866597c959ed296ebf312d2f2f59f66ce006dda

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page