# AiotraQ-Message
streamlit 風の構文を用いてインタラクティブなメッセージ送信に対応するプラグインです。
[![PyPI - Version](https://img.shields.io/pypi/v/aiotraq-message?label=aiotraq-message)](https://pypi.org/project/aiotraq-message/)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/toshi-pono/aiotraq/blob/main/LICENSE)
[![CI](https://github.com/toshi-pono/aiotraq/actions/workflows/ci.yml/badge.svg)](https://github.com/toshi-pono/aiotraq/actions/workflows/ci.yml)
## Installation
```bash
pip install aiotraq-message
```
## Requirements
AiotraQ-Message は AiotraQ に依存しています
- [AiotraQ](https://github.com/toshi-pono/aiotraq/tree/main/libs/aiotraq)
- [AiotraQ-Bot](https://github.com/toshi-pono/aiotraq/tree/main/libs/bot)
![overview](../../docs/docs/overview.svg)
## Usage
```python
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](https://toshi-pono.github.io/aiotraq/docs/api/components/components-overview/)
## License
This project is licensed under the terms of the MIT license.
Raw data
{
"_id": null,
"home_page": "https://github.com/toshi-pono/aiotraq",
"name": "aiotraq-message",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "traQ, bot, message, aiotraq",
"author": "toshi00",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/0a/ad/71beb9f30a6951d3816bb2a519a5dae64ec29839f144e467544b1f2f4327/aiotraq_message-0.2.4.tar.gz",
"platform": null,
"description": "# AiotraQ-Message\n\nstreamlit \u98a8\u306e\u69cb\u6587\u3092\u7528\u3044\u3066\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6\u306a\u30e1\u30c3\u30bb\u30fc\u30b8\u9001\u4fe1\u306b\u5bfe\u5fdc\u3059\u308b\u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u3059\u3002\n\n[![PyPI - Version](https://img.shields.io/pypi/v/aiotraq-message?label=aiotraq-message)](https://pypi.org/project/aiotraq-message/)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/toshi-pono/aiotraq/blob/main/LICENSE)\n[![CI](https://github.com/toshi-pono/aiotraq/actions/workflows/ci.yml/badge.svg)](https://github.com/toshi-pono/aiotraq/actions/workflows/ci.yml)\n\n## Installation\n\n```bash\npip install aiotraq-message\n```\n\n## Requirements\n\nAiotraQ-Message \u306f AiotraQ \u306b\u4f9d\u5b58\u3057\u3066\u3044\u307e\u3059\n\n- [AiotraQ](https://github.com/toshi-pono/aiotraq/tree/main/libs/aiotraq)\n- [AiotraQ-Bot](https://github.com/toshi-pono/aiotraq/tree/main/libs/bot)\n\n![overview](../../docs/docs/overview.svg)\n\n## Usage\n\n```python\nimport os\nimport asyncio\nfrom aiotraq_bot import TraqHttpBot\nfrom aiotraq_message import TraqMessage\n\nasync def component(am: TraqMessage, payload: str):\n am.write(\"Hello, World!\")\n am.write(payload)\n\n with am.spinner():\n # heavy task\n asyncio.sleep(3)\n\n am.write(\":done: Done!\")\n\nbot = TraqHttpBot(verification_token=os.getenv(\"BOT_VERIFICATION_TOKEN\"))\nresponse = TraqMessageManager(bot, os.getenv(\"BOT_ACCESS_TOKEN\"), \"https://q.trap.jp/api/v3\", \"https://q.trap.jp\")\n\n\n@bot.event(\"MESSAGE_CREATED\")\nasync def on_message_created(payload) -> None:\n channel_id = payload.message.channelId\n message = payload.message.plainText\n\n await response(component, channnel_id=channel_id, payload=message)\n\nif __name__ == \"__main__\":\n bot.run(port=8080)\n```\n\n### Component\n\nwrite, spinner, clear \u306a\u3069\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\n\n- write: \u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9001\u4fe1\u3057\u307e\u3059\n- spinner: \u30b9\u30d4\u30ca\u30fc\u3092\u8868\u793a\u3057\u307e\u3059\n- clear: \u9001\u4fe1\u3057\u305f\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u7a7a\u306b\u3057\u307e\u3059\n- clear_message: write \u3067\u9001\u4fe1\u3057\u305f\u30e1\u30c3\u30bb\u30fc\u30b8 1 \u3064\u3092\u524a\u9664\u3057\u307e\u3059\n- image: \u753b\u50cf\u3092\u9001\u4fe1\u3057\u307e\u3059\n- pyplot: matplotlib \u306e\u30b0\u30e9\u30d5\u3092\u9001\u4fe1\u3057\u307e\u3059\n- dataframe: pandas \u306e dataframe \u3092\u8868\u5f62\u5f0f\u3067\u8868\u793a\u3057\u307e\u3059\n\n\u8a73\u7d30: [\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\uff5c Components](https://toshi-pono.github.io/aiotraq/docs/api/components/components-overview/)\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "aiotraq Plugin that supports interactive message sending using Streamlit-style syntax for traQ",
"version": "0.2.4",
"project_urls": {
"Homepage": "https://github.com/toshi-pono/aiotraq",
"Repository": "https://github.com/toshi-pono/aiotraq",
"Source Code": "https://github.com/toshi-pono/aiotraq/tree/main/libs/message"
},
"split_keywords": [
"traq",
" bot",
" message",
" aiotraq"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "836291c909e7007a644f64ce79ae63752f60b81166ecdd409337aebd4824c5ca",
"md5": "1f1f3d0cc520d2918ac591e6076595fc",
"sha256": "0ca36efa003a153dc215342f3f2478267a7664605dba7e67bc7849a7be34e80d"
},
"downloads": -1,
"filename": "aiotraq_message-0.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1f1f3d0cc520d2918ac591e6076595fc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 8746,
"upload_time": "2024-07-21T17:19:47",
"upload_time_iso_8601": "2024-07-21T17:19:47.995806Z",
"url": "https://files.pythonhosted.org/packages/83/62/91c909e7007a644f64ce79ae63752f60b81166ecdd409337aebd4824c5ca/aiotraq_message-0.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0aad71beb9f30a6951d3816bb2a519a5dae64ec29839f144e467544b1f2f4327",
"md5": "5c4fb4498b0cc55f4d6308ede4507a2e",
"sha256": "d132cf5729050124a0a65f1aaf8278ba53616ac12d92e29957713bb5e87b9df0"
},
"downloads": -1,
"filename": "aiotraq_message-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "5c4fb4498b0cc55f4d6308ede4507a2e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 7947,
"upload_time": "2024-07-21T17:19:49",
"upload_time_iso_8601": "2024-07-21T17:19:49.623129Z",
"url": "https://files.pythonhosted.org/packages/0a/ad/71beb9f30a6951d3816bb2a519a5dae64ec29839f144e467544b1f2f4327/aiotraq_message-0.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-21 17:19:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "toshi-pono",
"github_project": "aiotraq",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aiotraq-message"
}