Skip to main content

pycqBot

go-cqhttp python 框架,可以用于快速塔建 bot

issuesforksstarslicense

项目文档不更新的话 请刷新浏览器缓存

项目文档 (移动至 Github Pages): https://fengliufeseliud.github.io/pycqBot/

go-cqhttp

支持 PyPy

可以使用 PyPy3 进行性能提升

pypy3 -m pip install pycqBot
# 改用 PyPy 运行
pypy3 ./main.py

演示

创建指令

from pycqBot import cqHttpApi, cqBot, cqLog
from pycqBot.data import *

cqLog()

def test(command_data, message: Message):
    message.reply("你好!")
 
bot = cqHttpApi().create_bot()
# 创建指令 "#test"
bot.command(test, "test")

bot.start()

cqCode

from pycqBot.cqCode import image, get_cq_code


cq_code = image("https://i.pixiv.cat/img-master/img/2020/03/25/00/00/08/80334602_p0_master1200.jpg")
# 字典 与 cqCode 互转
print(cq_code, "\n\n", get_cq_code(cq_code))

事件处理

from pycqBot import cqHttpApi, cqBot, cqLog
from pycqBot.data import *


cqLog()

class myCqBot(cqBot):
    
    # 防撤回
    def notice_group_recall(self, event: Notice_Event):
        message = self.cqapi.get_msg(event.data["message_id"])["data"]
        self.cqapi.send_group_msg(message["group_id"], "有一条消息无了 群友还没看清楚呢! %s:%s" % ( 
            message["sender"]["nickname"],
            message["message"]
        ))

bot = myCqBot(cqHttpApi()).start()

Release files for pycqBot 0.5.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycqBot 0.5.1.1
File Size Uploaded
pycqBot-0.5.1.1.tar.gz 41.8 kB Details

Release files / pycqBot-0.5.1.1.tar.gz

Download URL pycqBot-0.5.1.1.tar.gz
Size 41.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4e41625d7e3e88d913dc2a469f2d619fcb4d664efee30a2b549840c5611647b5
BLAKE2b-256 checksum
How to use checksums
6914fedb77e45e520818b8a9bca1e498b97fed0fafa38d70f1b2fb861d4ff554
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.5.1.1 This release

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.5

1 release file

0.4.4.1

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0.2

1 release file

0.4.0.1

1 release file

0.4.0

1 release file

0.3.4.1

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1.1

1 release file

0.3.0

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page