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()