Skip to main content

aiotraq Plugin that supports interactive message sending using Streamlit-style syntax for traQ

Project description

AiotraQ-Message

streamlit 風の構文を用いてインタラクティブなメッセージ送信に対応するプラグインです。

PyPI - Version GitHub license CI

Installation

pip install aiotraq-message

Requirements

AiotraQ-Message は AiotraQ に依存しています

overview

Usage

import os
import asyncio
from aiotraq_bot import TraqHttpBot
from aiotraq_message import TraqMessage

async def component(am: TraqMessage, payload: str):
    am.write("Hello, World!")
    am.write(payload)

    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", "https://q.trap.jp")


@bot.event("MESSAGE_CREATED")
async def on_message_created(payload) -> None:
    channel_id = payload.message.channelId
    message = payload.message.plainText

    await response(component, channnel_id=channel_id, payload=message)

if __name__ == "__main__":
    bot.run(port=8080)

Component

write, spinner, clear などのメソッドを使うことができます

  • write: メッセージを送信します
  • spinner: スピナーを表示します
  • clear: 送信したメッセージを空にします
  • clear_message: write で送信したメッセージ 1 つを削除します
  • image: 画像を送信します
  • pyplot: matplotlib のグラフを送信します
  • dataframe: pandas の dataframe を表形式で表示します

詳細: ドキュメント| Components

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.2.5.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

aiotraq_message-0.2.5-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for aiotraq_message-0.2.5.tar.gz
Algorithm Hash digest
SHA256 853734da8c96f82f5ed9735c95e61154ff8088d081a6d47cc30f1d1215c5239f
MD5 33bd9618f4bc808f63f8837c7d7d4c80
BLAKE2b-256 5d1343c66d873d2e090a54550c0fc59a4e9a4b794cc83fafd085a328a1425a35

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiotraq_message-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_message-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for aiotraq_message-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0cf6d567adea477c23e1f9fc4cb5d8f6c103933ccecc5a4f9d4c843cb112d440
MD5 74c8ceb2f100d6c92f8d3b012e0a87e2
BLAKE2b-256 5c516b81b2f74f93511cc01975068e712b00c28d4d25a894dbde0965e894c0ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiotraq_message-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