AliceBot
Simple Python asynchronous multi-backend robot framework
Documentation · Guides · API Reference · Examples
Introduction
AliceBot is a simple Python asynchronous multi-backend robot framework that supports multiple protocol adaptations. You can easily write plug-ins that are easy to learn and use to expand its functionality.
This project is inspired by the NoneBot project. You can check the similarities and differences between the two projects in the comparison section so that you can choose a robot framework that is more suitable for you.
Features
- Simple : AliceBot uses a very flexible and easy-to-use plug-in writing method. You only need to write two methods to implement a powerful plug-in.
- Flexible : AliceBot's adaptation protocol is not bound to any library or network protocol. You are free to choose or write an adapter that suits you.
- Efficient : AliceBot is based on Python's asynchronous I/O and can easily handle a large number of requests. Less packaging, pursuing the best performance while maintaining ease of use.
Currently, AliceBot officially maintains the following protocol adaptations:
- OneBot (CQHTTP) protocol (supports QQ, etc.) ws and ws-reverse connection methods
- OneBot v12 protocol ws and ws-reverse connection methods
- mirai-api-http protocol 2.0+ ws and reverse-ws connection methods
- Outgoing (callback) connection method of DingTalk Enterprise Robot
- Telegram robot polling and webhook connection methods
More protocols are being adapted...
More information: Introduction - AliceBot documentation
Start now
Install:
pip install alicebot[all]
First AliceBot project:
from alicebot import Bot
bot = Bot ()
bot . load_adapters ( "alicebot.adapter.cqhttp" )
bot . run ()
The first AliceBot plug-in:
from alicebot import Plugin
class Echo ( Plugin ):
async def handle ( self ) -> None :
await self . event . reply ( self . event . message . replace ( "echo " , "" ))
async def rule ( self ) -> bool :
if self . event . adapter . name != "cqhttp" :
return False
if self . event . type != "message" :
return False
return self . event . message . startswith ( "echo " )
See the AliceBot documentation for more information.
contrast
This project is inspired by the NoneBot project. The following is a brief introduction to the similarities and differences between the two.
Similar points:
- Both are written in Python and use coroutine asynchronous high-performance robot framework.
- Both support multiple protocols.
- Both will parse and process the events received by the robot, and distribute them to plug-ins (event responders) according to priority to complete specific functions.
- Both are open source based on the MIT license, which means you can use this project as long as you follow the license.
Differences:
- In general, NoneBot is a more comprehensive robot framework, while AliceBot is a small and concise robot framework that does not contain some complex advanced features, but is more flexible and easy to learn.
- AliceBot's plug-in writing style is different from NoneBot. Relatively speaking, AliceBot focuses more on ease of entry and "progressive framework", which means that most of AliceBot's functions are optional and you only need to know very little knowledge. Get started, and as your project grows in size and complexity, you can continue to drill down into the features you need without having to master them all right away. “It’s a framework that can grow with you and adapt to your different needs.”
- NoneBot is deeply bound to the HTTP/WebSocket communication protocol in terms of implementation. It requires a "driver" that supports the ASGI server protocol, while AliceBot is not bound to any protocol. It can even be used to drive your Raspberry Pi smart speaker. Of course, there's no difference if you just need a bot framework that supports common web chat tools.
- NoneBot has a relatively large user base and community size, and also has a large number of plug-ins, while AliceBot is a nascent project, which means that if you use NoneBot you may find it easier to find plug-ins that you are interested in that have been written, and You can also find relevant information or get answers faster when you encounter problems.
All in all, both have their own characteristics, and you can choose according to your needs.
license
AliceBot is open source under the MIT license.
The icon for this project was drawn by Misty Little Dream God and is open for use as part of this project under the same license as this project.