A universal multiplatform message bot
Project description
omniunibot
🤖 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
orpython setup.py develop
📜 Usage
Standalone non-blocking mode
-
Prepare a config file
- Default config path:
$HOME/configs/omniunibot.json
- Config example
{ "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" }
- Default config path:
-
Start the bot server
python -m omniunibot
-
Use the client-side code in your code
from omniunibot import OmniUniBotClient client = OmniUniBotClient("tcp://localhost:58655") client.send( channel="test-channels", title="msgTitle", msg="msgContent" )
Integration mode (Blocking mode, not recommended)
# 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
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
omniunibot-0.0.3.post2.tar.gz
(8.1 kB
view hashes)
Built Distribution
Close
Hashes for omniunibot-0.0.3.post2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa9d5407f5aae5660b694266ad8a3e7e5615133273c437bf356c27cfaf0cba7f |
|
MD5 | c5a40ec01e4dc0ddeef85d3432ecc7c4 |
|
BLAKE2b-256 | 30e4cfaa76087bb253d993f1c71e0cc241c8e569f5b1e4a663d075fca2575a4a |