Swiftpack.co - iWECon/dingbot as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by iWECon.
iWECon/dingbot 2.0.3
钉钉机器人 Swift, Dingbot, DingtalkBot
⭐️ 0
🕓 1 week ago
iOS macOS linux
.package(url: "https://github.com/iWECon/dingbot.git", from: "2.0.3")

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;

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")

GitHub

link
Stars: 0
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Bump to 2.0.3
1 week ago

Fill use document, update package dependence.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics