All Projects → SSmJaE → PepperBot

SSmJaE / PepperBot

Licence: MIT License
An intuitive multi-platform bot framework, write once, run everywhere. 一个符合直觉的跨社交平台机器人框架,轻松地在平台间传递消息,支持QQ、微信

Programming Languages

python
139335 projects - #7 most used programming language
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to PepperBot

Aiocqhttp
A Python SDK with async I/O for CQHTTP.
Stars: ✭ 162 (+671.43%)
Mutual labels:  asyncio, qq
Shiro
基于OneBot协议的QQ机器人快速开发框架
Stars: ✭ 78 (+271.43%)
Mutual labels:  qq, onebot
Ariadne
一个优雅且完备的 Python QQ 自动化框架,基于 Mirai API HTTP v2。 Powered by Graia Project.
Stars: ✭ 234 (+1014.29%)
Mutual labels:  asyncio, qq
QQSpider
批量导出QQ好友,并获取好友信息
Stars: ✭ 22 (+4.76%)
Mutual labels:  qq
CoffeeChat
opensource im with server(go) and client(flutter+swift)
Stars: ✭ 111 (+428.57%)
Mutual labels:  qq
rigor
HTTP-based DSL for for validating RESTful APIs
Stars: ✭ 65 (+209.52%)
Mutual labels:  asyncio
fastapi-sqlalchemy-1.4-async
https://rogulski.it/blog/sqlalchemy-14-async-orm-with-fastapi/
Stars: ✭ 17 (-19.05%)
Mutual labels:  asyncio
deeppyer
Image deepfryer written in Python.
Stars: ✭ 36 (+71.43%)
Mutual labels:  asyncio
findssh
Asyncio concurrent Python finds SSH servers (or other services with open ports) on an IPv4 subnet, WITHOUT NMAP
Stars: ✭ 36 (+71.43%)
Mutual labels:  asyncio
aiosqlite3
sqlite3 on asyncio use loop.run_in_executor proxy
Stars: ✭ 21 (+0%)
Mutual labels:  asyncio
automate-home
Yet another python home automation (iot) project. Because a smart light is more than just on or off.
Stars: ✭ 59 (+180.95%)
Mutual labels:  asyncio
sanic-url-shortener
Example of how to use Sanic and asyncpg (PostgreSQL)
Stars: ✭ 16 (-23.81%)
Mutual labels:  asyncio
Sharingan
We will try to find your visible basic footprint from social media as much as possible - 😤 more sites is comming soon
Stars: ✭ 13 (-38.1%)
Mutual labels:  asyncio
waio
Is a pretty simple and fully asynchronous framework for WhatsApp Business API written in Python 3.7 with asyncio and aiohttp.
Stars: ✭ 18 (-14.29%)
Mutual labels:  asyncio
aiorabbit
An AsyncIO RabbitMQ client for Python 3
Stars: ✭ 18 (-14.29%)
Mutual labels:  asyncio
aiohttp-jwt
aiohttp middleware and helper utils for working with JSON web token.
Stars: ✭ 70 (+233.33%)
Mutual labels:  asyncio
aioimaplib
Python asyncio IMAP4rev1 client library
Stars: ✭ 77 (+266.67%)
Mutual labels:  asyncio
fastapi-boilerplate
FastAPI boilerplate for real world production
Stars: ✭ 145 (+590.48%)
Mutual labels:  asyncio
aiodogstatsd
An asyncio-based client for sending metrics to StatsD with support of DogStatsD extension
Stars: ✭ 26 (+23.81%)
Mutual labels:  asyncio
aiolimiter
An efficient implementation of a rate limiter for asyncio.
Stars: ✭ 121 (+476.19%)
Mutual labels:  asyncio

PepperBot

一个符合直觉的跨社交平台机器人框架,轻松地在平台间传递消息,支持QQ、微信

文档 · QQ交流群

生而跨平台

  • QQ 基于 Onebot
  • 微信基于可爱猫
  • 提供了跨平台、易用的消息类型(片段)
  • 通用事件,比如群消息、私聊消息等,提供了统一的接口,只需要写一次代码,就可以无缝应用到各个平台上,跨平台的消息传递从未如此轻松随意
  • 可以跨群、跨平台共享指令(的状态)

性能也够用

  • 底层基于异步的 Sanic 框架(目前有一定生态的 python web 框架,性能最好的),性能相当不错
  • 轻量,主要处理消息,对于其他功能,暴露底层接口,方便实现深度定制

自带全家桶

  • 支持 Django 风格集中化路由、flask 风格装饰器式路由&权限系统
  • Django 类视图风格/Vue 生命周期风格的指令系统,Fast Api 风格的依赖注入
  • 定时任务
  • 日志支持
  • 数据库连接(内置 sqlite)
  • 链式调用 api(行为链)
  • cli,快速创建项目,安装社区指令

接口合语义

  • api 符合直觉,直观,流畅地把想法映射到代码上
  • 基于 python3.6 之后的类型注解,提供了完全的类型提示
  • 大部分可以自动获取的参数,都会自动获取,不需要每次手动提供了
  • 只会动态注入用到的参数,没必要每次写一长串用不到的参数了!

测试文档全

  • 文档正在写
  • 测试在补了
  • 大量官方示例/指令
  • 来自作者的 QA(加群以获取)
  • 通过元编程(ast 之类)手段,对编写的各种代码进行规则检查,并输出易于理解的错误信息,将问题消灭在框架启动之前

安装

pip install pepperbot

使用

具体使用见文档

示例

六行代码实现消息互转

class WhateverNameYouWant:
    async def group_message(self, bot: UniversalGroupBot, chain: MessageChain):
        if bot.onebot: # 转发qq消息至微信
            await bot.arbitrary.keaimao.group_message("19521241254@chatroom", *chain.segments)

        if bot.keaimao: # 转发微信消息至qq
            await bot.arbitrary.onebot.group_message("1041902989", *chain.segments)

只需要非常少的代码,就可以实现跨平台的群消息的响应

@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_msg(
                Text("没人"),
                Face(150)
            )
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].