lozn00 / py-pcqq

仅用Python3标准库编写的低配PCQQ协议库,可以在安卓设备的qpython中安装运行

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python语言PCQQ协议的简单封装,萌新代码写的很烂,大佬多多包涵

你可以在我博客的这篇帖子查看更详细的介绍与使用方法

最近入坑饥荒所以退坑编程,本项目大概率咕咕咕,有意见请联系QQ: 2224825532

已实现功能

登录

  • 扫码登录
  • 账密登录
  • 退出登录

发送消息

  • At
  • 文本
  • 表情
  • 卡片

接收消息

  • At
  • 文本
  • 图片
  • 表情

使用案例

你可以使用 pip install py-pcqq 来安装本协议库,开发案例如下:

import pcqq

@pcqq.on_event(pcqq.checkType('group_increase'))
def welcome(session: pcqq.Session):
    msg = pcqq.MessageSegment()
    msg.AddAt(session.event.UserID)
    msg.AddText('欢迎新人')
    session.send(msg)

@pcqq.on_regex('^(.{0,2})点歌(.{1,25})$')
def music(session: pcqq.Session):
    typ, keyword = session.get()[0]
    typ = {'': 'qqmusic', '酷我': 'kuwo', '酷狗': 'kugou', '网易': 'cloud163'}.get(typ, '')
    if typ and keyword:
        session.send(f'[PQ:music,type={typ},keyword={keyword}]')

@pcqq.on_full('hello')
def hello(session: pcqq.Session):
    session.send('hello world')

@pcqq.on_command('复读',aliases=['跟我读'])
def reread(session: pcqq.Session):
    words = session.get('请告诉我要复读的内容')
    session.send(words)

pcqq.init()
pcqq.run()

About

仅用Python3标准库编写的低配PCQQ协议库,可以在安卓设备的qpython中安装运行


Languages

Language:Python 100.0%