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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

Supported by

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