Skip to main content

A universal multiplatform message bot

Project description

omniunibot

Upload Python Package

🤖 An omnipotent universal message bot library for python

  • Supported platforms
    • Feishu
    • Slack
    • Dingtalk
    • 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
      {
          "channels": {
              "test-channels": [
                  {
                      "platform": "feishu",
                      "webhook": "https://open.feishu.cn/open-apis/bot/v2/hook/xxxxx-xxxxx",
                      "secret": "xxxxx"
                  },
                  {
                      "platform": "slack",
                      "webhook": "https://hooks.slack.com/services/xxxx/xxxx/xxxxxx"
                  },
                  {
                      "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

    python -m omniunibot
    
  3. 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, SlackBot

# initialize bots
bot = FeishuBot('<webhook>', '<secret>')
bot = DingTalkBot('<webhook>', '<secret>')
bot = WeComBot('<webhook>')
bot = SlackBot('<webhook>')

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

You could check the code example in ./example

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

omniunibot-0.0.6.tar.gz (8.8 kB view hashes)

Uploaded Source

Built Distribution

omniunibot-0.0.6-py3-none-any.whl (11.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page