Skip to main content

Async ready traQ Bot library

Project description

AiotraQ-Bot

Async ready traQ Bot library written in Python.

PyPI - Version GitHub license CI

Requirements

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

Installation

pip install aiotraq-bot

Usage

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

traQ->BOTサーバーへのイベント受け取り部分を補助します。 BOTサーバー->traQへのイベント送信は AiotraQAiotraQ-Message 等を利用してください。

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 イベントを型ヒントを使って指定する場合

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

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

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

詳細は ドキュメント|Bot サーバーの作成を参照してください。

Acknowledgements

This project is inspired by python-traq-bot.

License

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

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

aiotraq_bot-0.2.5.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

aiotraq_bot-0.2.5-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file aiotraq_bot-0.2.5.tar.gz.

File metadata

  • Download URL: aiotraq_bot-0.2.5.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aiotraq_bot-0.2.5.tar.gz
Algorithm Hash digest
SHA256 8c68990b2e3efe4eab78e0ba706b61f5f4a62ff51c5a2055ebbd94b111d26e2f
MD5 03be90cfd5d1bd5a14ecfe915cd51e1a
BLAKE2b-256 9eaff37a482b0810228d0e3361174576f7e18810da7a8f8048b771221570fc3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiotraq_bot-0.2.5.tar.gz:

Publisher: release.yml on toshi-pono/aiotraq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aiotraq_bot-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: aiotraq_bot-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aiotraq_bot-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5f7ea3547cdeb8d2a17df8e3c5ca6c0f008175c45a7d50ef67ea80e9678963fc
MD5 ead6e2d3b5758faed15d369cbd5efa8f
BLAKE2b-256 a0bd3bd7618a55b64b5a6e5665e136db689c8963a54c564ad82153b2da53352c

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiotraq_bot-0.2.5-py3-none-any.whl:

Publisher: release.yml on toshi-pono/aiotraq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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