aiotraq-bot


Nameaiotraq-bot JSON
Version 0.2.4 PyPI version JSON
download
home_pagehttps://github.com/toshi-pono/aiotraq
SummaryAsync ready traQ Bot library
upload_time2024-07-21 17:19:46
maintainerNone
docs_urlNone
authortoshi00
requires_python<4.0,>=3.10
licenseMIT
keywords traq bot async aiotraq
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # AiotraQ-Bot

Async ready traQ Bot library written in Python.

[![PyPI - Version](https://img.shields.io/pypi/v/aiotraq-bot)](https://pypi.org/project/aiotraq-bot/)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/toshi-pono/aiotraq/blob/main/LICENSE)
[![CI](https://github.com/toshi-pono/aiotraq/actions/workflows/ci.yml/badge.svg)](https://github.com/toshi-pono/aiotraq/actions/workflows/ci.yml)

## Requirements

AiotraQ-Bot は以下のライブラリを使用しています。

- [FastAPI](https://fastapi.tiangolo.com/): サーバーの実装
- [Uvicorn](https://www.uvicorn.org/): サーバーの実行
- [Pydantic](https://docs.pydantic.dev/latest/): データのバリデーション

## Installation

```bash
pip install aiotraq-bot
```

## Usage

`TraqHttpBot` を使って http bot を作成することができます。

`traQ->BOTサーバー`へのイベント受け取り部分を補助します。
`BOTサーバー->traQ`へのイベント送信は [AiotraQ](https://github.com/toshi-pono/aiotraq/tree/main/libs/aiotraq)、[AiotraQ-Message](https://github.com/toshi-pono/aiotraq/tree/main/libs/message) 等を利用してください。

```python
import os
from aiotraq_bot import TraqHttpBot

bot = TraqHttpBot(verification_token=os.getenv("BOT_VERIFICATION_TOKEN"))

@bot.event()
async def on_message(payload: MessageCreatedPayload):
    print(payload)

if __name__ == "__main__":
  bot.run()
```

### Event handler の登録

イベントの登録は `@bot.event()` デコレータを使って行うことができます。
event の引数として対象のイベントを指定するか、関数の型ヒントを使って指定することができます。

`MESSAGE_CREATED` イベントを型ヒントを使って指定する場合

```python
@bot.event()
async def on_message(payload: MessageCreatedPayload):
    print(payload)
```

`MESSAGE_CREATED`イベントを引数を用いて指定する場合

```python
@bot.event("MESSAGE_CREATED")
async def on_message(payload):
    print(payload)
```

詳細は [ドキュメント|Bot サーバーの作成](https://toshi-pono.github.io/aiotraq/docs/intro/)を参照してください。

## Acknowledgements

This project is inspired by [python-traq-bot](https://github.com/eyemono-moe/python-traq-bot).

## License

This project is licensed under the terms of the MIT license.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/toshi-pono/aiotraq",
    "name": "aiotraq-bot",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "traQ, bot, async, aiotraq",
    "author": "toshi00",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/23/fe/59defb7766d743d304b0190373a86ac0dbaee7fef0055f7b1cf50b139981/aiotraq_bot-0.2.4.tar.gz",
    "platform": null,
    "description": "# AiotraQ-Bot\n\nAsync ready traQ Bot library written in Python.\n\n[![PyPI - Version](https://img.shields.io/pypi/v/aiotraq-bot)](https://pypi.org/project/aiotraq-bot/)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/toshi-pono/aiotraq/blob/main/LICENSE)\n[![CI](https://github.com/toshi-pono/aiotraq/actions/workflows/ci.yml/badge.svg)](https://github.com/toshi-pono/aiotraq/actions/workflows/ci.yml)\n\n## Requirements\n\nAiotraQ-Bot \u306f\u4ee5\u4e0b\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002\n\n- [FastAPI](https://fastapi.tiangolo.com/): \u30b5\u30fc\u30d0\u30fc\u306e\u5b9f\u88c5\n- [Uvicorn](https://www.uvicorn.org/): \u30b5\u30fc\u30d0\u30fc\u306e\u5b9f\u884c\n- [Pydantic](https://docs.pydantic.dev/latest/): \u30c7\u30fc\u30bf\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\n\n## Installation\n\n```bash\npip install aiotraq-bot\n```\n\n## Usage\n\n`TraqHttpBot` \u3092\u4f7f\u3063\u3066 http bot \u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\n\n`traQ->BOT\u30b5\u30fc\u30d0\u30fc`\u3078\u306e\u30a4\u30d9\u30f3\u30c8\u53d7\u3051\u53d6\u308a\u90e8\u5206\u3092\u88dc\u52a9\u3057\u307e\u3059\u3002\n`BOT\u30b5\u30fc\u30d0\u30fc->traQ`\u3078\u306e\u30a4\u30d9\u30f3\u30c8\u9001\u4fe1\u306f [AiotraQ](https://github.com/toshi-pono/aiotraq/tree/main/libs/aiotraq)\u3001[AiotraQ-Message](https://github.com/toshi-pono/aiotraq/tree/main/libs/message) \u7b49\u3092\u5229\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002\n\n```python\nimport os\nfrom aiotraq_bot import TraqHttpBot\n\nbot = TraqHttpBot(verification_token=os.getenv(\"BOT_VERIFICATION_TOKEN\"))\n\n@bot.event()\nasync def on_message(payload: MessageCreatedPayload):\n    print(payload)\n\nif __name__ == \"__main__\":\n  bot.run()\n```\n\n### Event handler \u306e\u767b\u9332\n\n\u30a4\u30d9\u30f3\u30c8\u306e\u767b\u9332\u306f `@bot.event()` \u30c7\u30b3\u30ec\u30fc\u30bf\u3092\u4f7f\u3063\u3066\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\nevent \u306e\u5f15\u6570\u3068\u3057\u3066\u5bfe\u8c61\u306e\u30a4\u30d9\u30f3\u30c8\u3092\u6307\u5b9a\u3059\u308b\u304b\u3001\u95a2\u6570\u306e\u578b\u30d2\u30f3\u30c8\u3092\u4f7f\u3063\u3066\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\n\n`MESSAGE_CREATED` \u30a4\u30d9\u30f3\u30c8\u3092\u578b\u30d2\u30f3\u30c8\u3092\u4f7f\u3063\u3066\u6307\u5b9a\u3059\u308b\u5834\u5408\n\n```python\n@bot.event()\nasync def on_message(payload: MessageCreatedPayload):\n    print(payload)\n```\n\n`MESSAGE_CREATED`\u30a4\u30d9\u30f3\u30c8\u3092\u5f15\u6570\u3092\u7528\u3044\u3066\u6307\u5b9a\u3059\u308b\u5834\u5408\n\n```python\n@bot.event(\"MESSAGE_CREATED\")\nasync def on_message(payload):\n    print(payload)\n```\n\n\u8a73\u7d30\u306f [\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8|Bot \u30b5\u30fc\u30d0\u30fc\u306e\u4f5c\u6210](https://toshi-pono.github.io/aiotraq/docs/intro/)\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002\n\n## Acknowledgements\n\nThis project is inspired by [python-traq-bot](https://github.com/eyemono-moe/python-traq-bot).\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Async ready traQ Bot library",
    "version": "0.2.4",
    "project_urls": {
        "Homepage": "https://github.com/toshi-pono/aiotraq",
        "Repository": "https://github.com/toshi-pono/aiotraq",
        "Source Code": "https://github.com/toshi-pono/aiotraq/tree/main/libs/bot"
    },
    "split_keywords": [
        "traq",
        " bot",
        " async",
        " aiotraq"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6c364bede2908ecf6677702b282be02f33f910c46f8d711dac9290bd61ed2ee5",
                "md5": "78587010476bc7cad0d138f6cf2a4da8",
                "sha256": "7992f0bd95a15e43d0a627e06cf30fadc5fe7358cc005a3dc68d6eac3627ffa8"
            },
            "downloads": -1,
            "filename": "aiotraq_bot-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "78587010476bc7cad0d138f6cf2a4da8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 9449,
            "upload_time": "2024-07-21T17:19:45",
            "upload_time_iso_8601": "2024-07-21T17:19:45.306588Z",
            "url": "https://files.pythonhosted.org/packages/6c/36/4bede2908ecf6677702b282be02f33f910c46f8d711dac9290bd61ed2ee5/aiotraq_bot-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "23fe59defb7766d743d304b0190373a86ac0dbaee7fef0055f7b1cf50b139981",
                "md5": "db5082ce242bbd878fe3d382f626bc09",
                "sha256": "7236f6dc0359cac2b27309a337e4f779b125a1bb0ca6b3e59d658a2b016a405b"
            },
            "downloads": -1,
            "filename": "aiotraq_bot-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "db5082ce242bbd878fe3d382f626bc09",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 8067,
            "upload_time": "2024-07-21T17:19:46",
            "upload_time_iso_8601": "2024-07-21T17:19:46.717194Z",
            "url": "https://files.pythonhosted.org/packages/23/fe/59defb7766d743d304b0190373a86ac0dbaee7fef0055f7b1cf50b139981/aiotraq_bot-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-21 17:19:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "toshi-pono",
    "github_project": "aiotraq",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aiotraq-bot"
}
        
Elapsed time: 0.39118s