https://github.com/rf-tar-railt/avilla-cai
Impl of CAI Protocol for Avilla
https://github.com/rf-tar-railt/avilla-cai
Last synced: 3 months ago
JSON representation
Impl of CAI Protocol for Avilla
- Host: GitHub
- URL: https://github.com/rf-tar-railt/avilla-cai
- Owner: RF-Tar-Railt
- License: agpl-3.0
- Created: 2022-08-31T06:24:43.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-27T13:28:33.000Z (over 2 years ago)
- Last Synced: 2025-01-23T16:33:43.188Z (4 months ago)
- Language: Python
- Size: 318 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Avilla CAI
avilla 的 cai协议适配
## 示例
```python
from creart import create
from launart import Launart
from graia.amnesia.builtins.aiohttp import AiohttpClientService
from graia.broadcast import Broadcastfrom avilla.core import Avilla, Context, MessageReceived
from avilla.cai.protocol import CAIProtocol
from avilla.cai.config import CAIConfigbroadcast = create(Broadcast)
launart = Launart()
launart.add_service(AiohttpClientService())
avilla = Avilla(broadcast, launart, [CAIProtocol(CAIConfig("YourAccount", "YourPassword"))])@broadcast.receiver(MessageReceived)
async def on_message_received(ctx: Context, event: MessageReceived):
if ctx.client.follows("group.member(master-account)"):
await ctx.scene.send_message("Hello, Avilla!")launart.launch_blocking(loop=broadcast.loop)
```