PepperBot
1.0.0
Onebot
, Mirai
(to be implemented), OPQ
(to be implemented)可爱猫
Pyrogram
Django
or starlette
style centralized routing, or flask
or fastAPI
style decorator routingormar
(ormar is based on sqlalchemy
+ pydantic
)Selenium
-like event waiting fastAPI
style dependency injection pip install pepperbot
See the documentation for specific usage
Six lines of code to implement message exchange
class WhateverNameYouWant :
async def group_message ( self , bot : UniversalGroupBot , chain : MessageChain ):
if bot . onebot : # 转发qq消息至微信、TG
await bot . arbitrary . keaimao . group_message ( "19521241254@chatroom" , * chain . segments )
await bot . arbitrary . telegram . group_message ( "bot_father" , * chain . segments )
if bot . keaimao : # 转发微信消息至qq、TG
await bot . arbitrary . onebot . group_message ( "1041902989" , * chain . segments )
await bot . arbitrary . telegram . group_message ( "bot_father" , * chain . segments )
Only a very small amount of code is required to implement cross-platform group message response.
@ register ()
class WhateverNameYouWant :
# 注册跨平台群事件
async def group_message ( self , bot : GroupBot , chain : MessageChain , sender : Sender ):
# chain即为消息链,pure_text是消息中的纯文本,不包含表情、图片等
if "撤回我" == chain . pure_text :
await chain . withdraw () # 可以直接“撤回消息”,符合直觉
if "踢出我" == chain . pure_text :
await sender . kickout () # 可以直接踢出发言群员
# 也可以对消息链进行in操作,相当于in chain.pure_text
if "禁言我" in chain :
await sender . ban ( 10 ) # 可以直接禁言发言群员
if chain . regex ( "有人(在|吗|嘛|在吗).?" ):
# 发送一条群消息
# 接受任意个参数,必须是合法的消息片段,比如Text,Face,Image
await bot . group_message (
Text ( "没人" ),
Image ( "http://123.jpg" ),
)
plug-in market
pepperbot-ai-query