All Projects → opq-osc → botoy

opq-osc / botoy

Licence: MIT license
OPQ/IOTQQ/IOTBot的一个Python开发助手🐌

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to botoy

OPQBot
OPQBot
Stars: ✭ 67 (+11.67%)
Mutual labels:  opq, iotqq, opqbot, opqbot-plugin
IOTQQPlugins selfuse
自用IOTQQ/OPQbot插件合集
Stars: ✭ 16 (-73.33%)
Mutual labels:  iotqq, opqbot
OPQBot-GroupManager
OPQBot 群管理机器人
Stars: ✭ 25 (-58.33%)
Mutual labels:  iotqq, opqbot
botoy-plugins
一些botoy的插件
Stars: ✭ 16 (-73.33%)
Mutual labels:  opqbot, opqbot-plugin
Traceless.OPQ
OPQ C# SDK,可以使用Net Core完成QQ机器人插件开发,运行于任何Net Core支持的平台
Stars: ✭ 15 (-75%)
Mutual labels:  opq
OPQ-SetuBot
基于botoy和OPQBot的色图机器人
Stars: ✭ 194 (+223.33%)
Mutual labels:  opqbot

botoy

pypi python LICENSE

对机器人框架OPQ接口的 Python 封装, 因为功能模块耦合度低, 所以你可以完全使用该框架开发,也可以选取需要的内容到自己的项目中


安装

pip install botoy -i https://pypi.org/simple --upgrade

示例

如果你配置好了 OPQ,并且配置保持默认(bot 连接地址http://127.0.0.1:8888), 下面一行代码即可监听消息,并在收到群消息或好友消息内容为 test 时回复 ok

__import__('botoy').Botoy().on_group_msg(lambda ctx: __import__('botoy').Action(ctx.CurrentQQ).sendGroupText(ctx.FromGroupId, 'ok') if ctx.Content == 'test' else None).on_friend_msg(lambda ctx: __import__('botoy').Action(ctx.CurrentQQ).sendFriendText(ctx.FromUin, 'ok') if ctx.Content == 'test' else None).run()

当然上面的写法明显不常规,要实现和上面相同的功能,一般这样写

from botoy import Botoy, S
from botoy.decorators import equal_content


@equal_content("test")
def test(_):
    S.text("ok")


Botoy().on_group_msg(test).on_friend_msg(test).run()

文档

简单例子

插件模板

感谢

yuban10703 milkice

LICENSE

MIT

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].