A universal multiplatform message bot
Project description
omniunibot
⚠️ For
omniunibot>=0.3.0
, omniunibot will only supportPython>=3.12
. Please useomniunibot==0.2.0
forPython<3.12
.
🤖 An omnipotent universal message bot library for python
- Supported platforms
- Feishu
- Slack
- Dingtalk
- 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 &&
pip install .
📜 Client-Server Mode
-
Prepare a config file
-
Default config path:
$HOME/configs/omniunibot.json
-
Config example
{ "server": { "bind": "tcp://*:58655", "interval": 0.1 }, "client": { "bind": "tcp://localhost:58655" }, "log": { "level": "DEBUG", "dir": "/home/ubuntu/logs/omniunibot" }, "channel_groups": { "test_channels": [ { "platform": "Slack", "webhook": "https://hooks.slack.com/services/xxxx/xxxx/xxxx" }, { "platform": "Lark", "webhook": "https://open.feishu.cn/open-apis/bot/v2/hook/1a166e72-xxxx-xxxx-xxxx-3ae4f0fb51b7", "secret": "xxx" }, { "platform": "DingTalk", "webhook": "https://oapi.dingtalk.com/robot/send?access_token=xxx", "secret": "xxx" } ] } }
-
-
Start the bot server
python -m omniunibot.server
-
Use the client-side code in your code (see examples in ./tests)
📜 Standalone Mode
bot = DingTalkBot(
"https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxxxxxx",
"xxxxxxxxxxxxxx",
on_success="log",
on_failure="trace",
)
await bot.send({"text": "`test_dingtalkbot_1` Pass"})
bot = LarkBot(
"https://open.feishu.cn/open-apis/bot/v2/hook/xxxxx-d879-xxxxx-8d7b-xxxxxxxxxx",
"xxxxxxxxxxxxxxx",
on_success="log",
on_failure="trace",
)
await bot.send({"text": "`test_larkbot_1` Pass"})
bot = SlackBot(
"https://hooks.slack.com/services/xxxxxxxx/xxxxxxxx/xxxxxxxxxx",
on_success="log",
on_failure="trace",
)
await bot.send({"text": "`test_slackbot_1` Pass"})
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.4.1.tar.gz
(10.1 kB
view hashes)
Built Distribution
omniunibot-0.4.1-py3-none-any.whl
(13.6 kB
view hashes)
Close
Hashes for omniunibot-0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f605dcfcc438397059e24bdb4c047391728c88a574fbdae423275a79cd35837 |
|
MD5 | 4be14d23d9c41c5ee3003b44a1338e9d |
|
BLAKE2b-256 | b20d4b1793ef7da6a31e7a2d1e28ddadc0f60692821c9539f1d081751ee73b9f |