MiPA is a Misskey Bot Framework created to allow for Discord.py-like coding.
The API wrapper functionality provided by MiPA is managed by a library called MiPAC. Since the amount of work is significantly higher than that of MiPA, we are looking for people to work with us.
import asyncio
from aiohttp import ClientWebSocketResponse
from mipac.models.note import Note
from mipa.ext.commands.bot import Bot
class MyBot(Bot):
def __init__(self):
super().__init__()
async def _connect_channel(self):
await self.router.connect_channel(['main', 'home'])
async def on_ready(self, ws: ClientWebSocketResponse):
await self._connect_channel()
print('Logged in ', self.user.username)
async def on_reconnect(self, ws: ClientWebSocketResponse):
await self._connect_channel()
async def on_note(self, note: Note):
print(note.author.username, note.content)
if __name__ == '__main__':
bot = MyBot()
asyncio.run(bot.start('wss:https://example.com/streaming', 'your token here'))
For more examples, please see the examples folder. If you don't know how to do what you want in the examples, please feel free to create an issue.
This project is provided under the MIT LICENSE.
MiPA has been inspired by Discord.py in many ways. Therefore, in places where we use the source code of Discord.py, we specify the license of Discord.py at the beginning of the file. Please check the code for details.
- Discord.py
- We have been inspired by many aspects of Discord.py, such as the mechanism of Cogs and the management of tasks and states.