Skip to main content

爱发电适配器

Project description

nonebot-adapter-afdian

基于 NoneBot2 的爱发电适配器

使用

  1. 安装

    pip install nonebot-adapter-afdian
    
  2. 启用

    adapters = [
        { name = "Afdian", module_name = "nonebot.adapter.afdian" }
    ]
    
  3. 配置

    • NoneBot2

      DRIVER=~fastapi+~httpx
      HOST=0.0.0.0
      AFDIAN_HOOK_SECRET='<Your Secret>'
      AFDIAN_BOTS='[
          {
              "user_id": "<Your User Id>",
              "token": "<Your Token>"
          }
      ]'
      
    • 爱发电开发者控制台

      http://<IP>:<PORT>/afdian/webhooks/<user_id>
      

      or

      https://<IP>:<PORT>/afdian/<Your Secret>/webhooks/<user_id>
      

API

from nonebot import on_notice
from nonebot.adapters.afdian import OrderNotifyEvent, Bot

test_afd = on_notice()


@test_afd.handle()
async def handle_afd(bot: Bot, event: OrderNotifyEvent):
    print("订单:" + event.data.order)

    result1 = await bot.query_order_by_page(page=1)
    print(result1)

    result2 = await bot.query_order_by_out_trade_no(
        out_trade_no="202308200000000000000000001"
        )
    print(result2)

    result3 = await bot.query_order_by_order_list(
        order_list=["202308200000000000000000000", "202308200000000000000000001"]
        )
    print(result3)

    result4 = await bot.query_sponsor(page=1)
    print(result4)

    result5 = await bot.query_sponsor(page=1, per_page=20) # 查询第一页,每页20个
    print(result5)

特别感谢

贡献与支持

觉得好用可以给这个项目点个 Star 或者去 爱发电 投喂我。

有意见或者建议也欢迎提交 IssuesPull requests

开源许可

本项目使用 MIT 作为开源许可证。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot_adapter_afdian-0.1.6.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nonebot_adapter_afdian-0.1.6-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_adapter_afdian-0.1.6.tar.gz.

File metadata

File hashes

Hashes for nonebot_adapter_afdian-0.1.6.tar.gz
Algorithm Hash digest
SHA256 c28e6f6ddfd6704eae500657782ae9b9c7d9c07078f4cc88369b4defbb75d101
MD5 ca8a1c5713902447492d31a66a5682e3
BLAKE2b-256 ea4e699c4ae5da3a6641f109e2134e944b37f67f6ef1d420b25ce53936bd62cf

See more details on using hashes here.

File details

Details for the file nonebot_adapter_afdian-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_adapter_afdian-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 681167257522f7ceaf1859615c2a0c1561361e11195e665a98229104716d57fa
MD5 d3de4a69adaec5f0c9510580e9e73b12
BLAKE2b-256 ad5db4b73399018ac8592f65d187e077a7b2c0de9b6a71a957ea0377b7bdef04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page