aiotraq Plugin that supports interactive message sending using Streamlit-style syntax for traQ
Project description
aiotraq-message
streamlit 風の構文を用いてインタラクティブなメッセージ送信に対応するプラグインです。
Installation
pip install aiotraq-message
Requirements
aiotraq-message は aiotraq に依存しています
Usage
import os
import asyncio
from aiotraq_bot import TraqHttpBot
from aiotraq_message import TraqMessage
async def component(am: TraqMessage, *args):
am.write("Hello, World!")
with am.spinner():
# heavy task
asyncio.sleep(3)
am.write(":done: Done!")
bot = TraqHttpBot(verification_token=os.getenv("BOT_VERIFICATION_TOKEN"))
response = TraqMessageManager(bot, os.getenv("BOT_ACCESS_TOKEN"), "https://q.trap.jp/api/v3")
@bot.event("MESSAGE_CREATED")
async def on_message_created(payload) -> None:
channel_id = payload.message.channelId
await response(component, channnel_id=channel_id)
if __name__ == "__main__":
bot.run()
Component
write, spinner, clear などのメソッドを使うことができます
- write: メッセージを送信します
- spinner: スピナーを表示します
- clear: 送信したメッセージを空にします
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_message-0.1.0.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for aiotraq_message-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c8143ed9c822e589d5bd212344b6b21bee32de0aebff6c51c0ccf4030b161f3 |
|
MD5 | dc1f81935f12048fe3139d56dc6bf592 |
|
BLAKE2b-256 | bd824131844e967d07817750e64355b8ce6ce70c143671f185e27c0511efc69d |