Async ready traQ Bot library
Project description
aiotraq-bot
Async ready traQ Bot library written in Python.
Installation
TODO
Usage
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)
Acknowledgements
This project is inspired by python-traq-bot.
License
This project is licensed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
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.1.0.tar.gz
(6.8 kB
view hashes)
Built Distribution
Close
Hashes for aiotraq_bot-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3129113bedd4333ad30613ab43816a177291bc42a6feba1e39742f8dfdcd122a |
|
MD5 | 89222592790fdbab57f43cdbb58ea5ce |
|
BLAKE2b-256 | 25cf0df6a9a106f6e659e34176f94257dec34adeff4ca54f68bd239b3362a9e8 |