主要特点
- 使用
async和await的现代 Pythonic API。 - 优化速度和内存。
安装
需要 Python 3.8或以上的版本 和一根接入互联网的网线。
要安装库,你只需运行以下命令:
pip3 install -U qq.py
快速示例
from qq import *
class MyClient(Client):
async def on_ready(self):
print('使用', self.user, '登陆')
async def on_message(self, message):
# 不要回复自己
if message.author == self.user:
return
if 'ping' in message.content:
await message.channel.send('pong')
if __name__ == '__main__':
client = MyClient()
client.run(token='app_id.token')
Bot 示例
import qq
from qq.ext import commands
bot = commands.Bot(command_prefix='>', owner_id='你的用户ID') # owner_id 是 int 类型
@bot.event
async def on_ready():
print(f'以 {bot.user} 身份登录(ID:{bot.user.id})')
print('------')
@bot.command()
async def ping(ctx):
await ctx.send('pong')
bot.run('app_id.token')
你可以在 example 目录中找到更多示例。
链接
Metadata
Release files for qq.py 1.3.22
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qq.py-1.3.22.tar.gz | 193.5 kB | Without provenance | Details for qq.py-1.3.22.tar.gz |
Release files / qq.py-1.3.22.tar.gz
| Download URL | qq.py-1.3.22.tar.gz |
|---|---|
| Size | 193.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ce6c6a8a494ede01ab2b7fdf20b7f638bffe7703aa8869f7eb1f62b8751339e
|
|
BLAKE2b-256 checksum How to use checksums |
27a21780ecfca5c865ff04b7c4a8d797051aea1814936342c0272cd4cb170fed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for qq.py 1.3.22
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.