Async ready traQ Bot library
Project description
AiotraQ-Bot
Async ready traQ Bot library written in Python.
Requirements
AiotraQ-Bot は以下のライブラリを使用しています。
Installation
pip install aiotraq-bot
Usage
TraqHttpBot を使って http bot を作成することができます。
traQ->BOTサーバーへのイベント受け取り部分を補助します。
BOTサーバー->traQへのイベント送信は AiotraQ、AiotraQ-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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c68990b2e3efe4eab78e0ba706b61f5f4a62ff51c5a2055ebbd94b111d26e2f
|
|
| MD5 |
03be90cfd5d1bd5a14ecfe915cd51e1a
|
|
| BLAKE2b-256 |
9eaff37a482b0810228d0e3361174576f7e18810da7a8f8048b771221570fc3a
|
Provenance
The following attestation bundles were made for aiotraq_bot-0.2.5.tar.gz:
Publisher:
release.yml on toshi-pono/aiotraq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiotraq_bot-0.2.5.tar.gz -
Subject digest:
8c68990b2e3efe4eab78e0ba706b61f5f4a62ff51c5a2055ebbd94b111d26e2f - Sigstore transparency entry: 237197975
- Sigstore integration time:
-
Permalink:
toshi-pono/aiotraq@6785c7e7c1b85335bc85e3a01fe1927150852f53 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/toshi-pono
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6785c7e7c1b85335bc85e3a01fe1927150852f53 -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f7ea3547cdeb8d2a17df8e3c5ca6c0f008175c45a7d50ef67ea80e9678963fc
|
|
| MD5 |
ead6e2d3b5758faed15d369cbd5efa8f
|
|
| BLAKE2b-256 |
a0bd3bd7618a55b64b5a6e5665e136db689c8963a54c564ad82153b2da53352c
|
Provenance
The following attestation bundles were made for aiotraq_bot-0.2.5-py3-none-any.whl:
Publisher:
release.yml on toshi-pono/aiotraq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiotraq_bot-0.2.5-py3-none-any.whl -
Subject digest:
5f7ea3547cdeb8d2a17df8e3c5ca6c0f008175c45a7d50ef67ea80e9678963fc - Sigstore transparency entry: 237197976
- Sigstore integration time:
-
Permalink:
toshi-pono/aiotraq@6785c7e7c1b85335bc85e3a01fe1927150852f53 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/toshi-pono
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6785c7e7c1b85335bc85e3a01fe1927150852f53 -
Trigger Event:
workflow_dispatch
-
Statement type: