Skip to main content

OPQBot/IOTQQ/IOTBot的Python开发助手

Project description

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

CHANGE LOG

See releases

0.0.2

  • 修复模块导入错误

V0.0.1

初次发布

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

botoy-8.4.tar.gz (61.3 kB view hashes)

Uploaded source

Built Distribution

botoy-8.4-py3-none-any.whl (96.8 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page