Giter Club home page Giter Club logo

dingbot's Introduction

Dingbot

DingTalk bot (webhook).

钉钉自定义机器人,支持文本消息(Text Message)、链接消息(Link Message)以及Markdown Message.

支持 Vapor.

Features

支持全局统一或单独定义 accessToken、加签 signKey;

// 全局统一, 这里配置完成后, 使用 Dingbot.shared.send(_:) 默认均使用该配置
Dingbot.shared.configure = Dingbot.Configure(accessToken: String, signKey: String)

// 独立定义, 使用 .send(_:configure:) 时,将独立配置添加进去即优先使用独立配置
Dingbot.shared.send(_ message: DingbotMessage, configure: Dingbot.Configure)

DingbotMessage

// 文本消息 TextMessage

Dingbot.TextMessage("Input your text message", at: `Dingbot.At?`)

// 链接消息 LinkMessage
Dingbot.LinkMessage(title: String, text: String, messageUrl: String, picUrl: String? = nil)

// 富文本 MarkdownMessage
Dingbot.MarkdownMessage(title: String, content: String, at: Dingbot.At? = nil)

// Dingbot.At
Dingbot.At(atMobiles: [String]? = nil, atUserIds: [String]? = nil, isAtAll: Bool = false)

// send
let (data, response) = try await Dingbot.shared.send(Dingbot.TextMessage/LinkMessage/MarkdownMessage)
     ⬆️ Data, ⬆️ URLResponse

Platform version

使用 concurrency,可能需要支持的系统版本偏高:

iOS v13 or up;

macOS v12 or up;

linux swift >= 5.6.1;

Vapor Support

import Vapor
import Dingbot

public extension Request {

    var dingbot: Dingbot {
        Dingbot.shared
    }

}

public extension Application {

    var dingbot: Dingbot {
        Dingbot.shared
    }

}

Install

.package(url: "https://github.com/iWECon/Dingbot.git", from: "2.0.0")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.