Python implementation for ProtobufBot Server.
Project description
PyProtobufBot
Python implementation for ProtobufBot Server.
This project is still WORK IN PROGRESS, DO NOT use for production.
How to use
First, you need to pip install pypbbot
Second, write your echobot.py
as above:
from pypbbot import app, run_server, BaseDriver
from pypbbot.protocol import PrivateMessageEvent, GroupMessageEvent
class SimpleDriver(BaseDriver):
async def onPrivateMessage(self, event: PrivateMessageEvent):
if event.raw_message.startswith('#echo '):
await self.sendPrivateTextMessage(event.user_id, event.raw_message.replace('#echo ', ''))
async def onGroupMessage(self, event: GroupMessageEvent):
if event.raw_message.startswith('#echo '):
await self.sendGroupTextMessage(event.group_id, event.raw_message.replace('#echo ', ''))
app.default_driver = SimpleDriver
if __name__ == '__main__':
run_server(app='__main__:app', host='localhost', port=8082, reload=True, debug=True)
Finally, start the client and run python echobot.py
Have fun!
Setting the Client
Recommended Client: Go-Mirai-Client
Download and compile, then open the client program, edit application.yml
like above:
bot:
client:
ws-url: "ws://localhost:8082/ws/test/"
Restart the client, Then it should be able to connect to the echobot.py
in example.
Still Work In Progress
Current version has only implemented the little subset of ProtobufBotAPI. More functions are going to be added in future versions.
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
pypbbot-0.1b1.tar.gz
(27.4 kB
view hashes)
Built Distribution
pypbbot-0.1b1-py3-none-any.whl
(29.8 kB
view hashes)