Metadata-Version: 2.1
Name: omniunibot
Version: 0.0.3.post2
Summary: A universal multiplatform message bot
Home-page: https://github.com/yttty/omniunibot
Author: yttty
Author-email: yttty@noreply.com
License: MIT
Keywords: bots
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE

# omniunibot

[![Upload Python Package](https://github.com/yttty/omniunibot/actions/workflows/python-publish.yml/badge.svg)](https://github.com/yttty/omniunibot/actions/workflows/python-publish.yml)

### 🤖 An omnipotent universal message bot library for python
- Supported platforms
    - Dingtalk
    - Feishu
    - WeChat Work (WeCom)
- Features
    - Non-blocking mode for sending messages
    - Send to multiple platforms with one-line code

### 💻 Installation
- *(via pip)* `pip install -U omniunibot`
- *(via source)* clone this repo && `python setup.py install` or `python setup.py develop`

### 📜 Usage

#### Standalone non-blocking mode
1. Prepare a config file
    - Default config path: `$HOME/configs/omniunibot.json`
    - Config example
        ```json
        {
            "channels": {
                "test-channels": [
                    {
                        "platform": "feishu",
                        "webhook": "https://open.feishu.cn/open-apis/bot/v2/hook/xxxxx-xxxxx",
                        "secret": "xxxxx"
                    },
                    {
                        "platform": "dingtalk",
                        "webhook": "https://oapi.dingtalk.com/robot/send?access_token=xxxxx",
                        "secret": "SECxxxxx"
                    },
                    {
                        "platform": "wecom",
                        "webhook": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxx-xxxxx"
                    }
                ]
            },
            "bind": "tcp://*:58655"
        }
        ```
2. Start the bot server
    ```sh
    python -m omniunibot
    ```

3. Use the client-side code in your code
    ```py
    from omniunibot import OmniUniBotClient

    client = OmniUniBotClient("tcp://localhost:58655")
    client.send(
        channel="test-channels",
        title="msgTitle",
        msg="msgContent"
    )

    ```

#### Integration mode (Blocking mode, not recommended)

```py
# import bots
from omniunibot import FeishuBot, DingTalkBot, WeComBot

# initialize bots
bot = FeishuBot('<webhook_id>', '<secret>')
bot = DingTalkBot('<token>', '<secret>')
bot = WeComBot('<token>')

# send message
bot.sendQuickMessage('Test Passed')
```

You could check the code example in `./example`
