SwiftcordIPC
A light-weight and easy to use Discord IPC library backed by swift-nio
Swiftcord IPC is an easy to use Discord IPC library. Many other RPC / IPC libraries for Discord in Swift either don't work, or are very buggy. SwiftcordIPC is designed to be reliable and up-to-date.
Note: At the moment, we have not found a way to use SwiftcordIPC inside the App Sandbox, however I am actively working on a solution for this.
Installation
Add this project to your Package.swift
import PackageDescription
let package = Package(
dependencies: [
.Package(url: "https://github.com/cbyrneee/SwiftcordIPC.git", from: "1.0.0")
]
)
Usage example
import SwiftcordIPC
let ipc = SwiftcordIPC(id: "937029972139327558")
ipc.onReady = { data in
print("Ready! User: \(data.user.username)#\(data.user.discriminator)")
ipc.setPresence { data in
data.details = "hello"
data.state = "world"
data.assets = assets(largeImage: "hello", largeImageText: "world")
data.buttons = [
button(label: "click me!", url: "https://cbyrne.dev")
]
}
}
// An error will be thrown here if connection has failed, e.g. ConnectionError.noIpcFile
try ipc.connectAndBlock()
Meta
Conor Byrne – @cbyrnedev – hello@cbyrne.dev
Distributed under the MIT license. See LICENSE
for more information.