The Discord API implementation behind Swiftcord, implemented completely from scratch in Swift

Overview

DiscordKit

The Discord API implementation that powers Swiftcord

This implementation has fully functional REST and Gateway support, but is mainly geared towards human accounts and not bots.

If you like DiscordKit, please give it a star! It helps motivate me to continue developing it

Check out Swiftcord for an example of a project that uses DiscordKit!

Join the Swiftcord Discord server here!

WIP Developer Documentation is available here.

Comments
  • Active Developer Badge Support

    Active Developer Badge Support

    This adds support for the active developer badge on the backend.

    The Update DiscordKitCore.swift commit was needed for compilation on my end (with the frontend), you may not need it

    opened by PiemanAU 1
  • patch (logging): Migrate to SwiftLog

    patch (logging): Migrate to SwiftLog

    This is a non-breaking PR to migrate all uses of OSLog to the cross-platform SwiftLog package. This is done mainly to prepare DiscordKit for life on Linux, and because OSLog wasn't that useful anyways and more troublesome in many ways.

    opened by cryptoAlgorithm 0
  • DiscordKit Rearchitect

    DiscordKit Rearchitect

    This PR has major changes to the architecture of DiscordKit, to allow supporting bots easier in the future. There are major breaking changes, which are supported by the discordkit-rearchitect branch in Swiftcord.

    opened by cryptoAlgorithm 0
  • Butter 🧈

    Butter 🧈

    Performance improvements. Corresponding PR for butter branch in Swiftcord.

    Optimisations are not as major as those in Swiftcord, and changes were more to support those made in Swiftcord.

    Breaking change: user in gateway cache is now a CurrentUser struct.,

    opened by cryptoAlgorithm 0
  • Handle and update more user settings

    Handle and update more user settings

    Previously, only the guild ordering user setting was handled. This PR handles some other settings, and stores the whole user settings struct in the gateway cache. It also merges the updated user setting with the old struct when an update event is received since Discord only sends partial user settings in the update event.

    opened by cryptoAlgorithm 0
  • Handle events related to DM support

    Handle events related to DM support

    This is the corresponding PR in Swiftcord

    Handles some events and updates cache with users sent in ready event. Allows proper first-class DM support in Swiftcord.

    What changed:

    • last_message_id in channels are now updated (allows proper ordering of DMs)
    • [Breaking] Cached users are now stored as a [Snowflake: User] dict instead of a [User] array
    opened by cryptoAlgorithm 0
  • Proper cache updating, handles events to keep cached guilds/channels fresh

    Proper cache updating, handles events to keep cached guilds/channels fresh

    This PR handles channel and guild gateway events to keep cached data fresh. Please also view the corresponding PR in Swiftcord for more info. This also ensures proper SwiftUI view rendering by calling objectWillChange.send() whenever the cache is modified.

    Note: Breaking API changes were introduced, including changing the cached guilds from an array to a [guildID: guild] dictionary. They are relatively minor and should make it easier to use DiscordKit. Please look at Swiftcord for an implementation example.

    opened by cryptoAlgorithm 0
  • feat: Bot support

    feat: Bot support

    This PR aims to bring 1st-class bot support to DiscordKit. The checkboxes below outlines what's completed and what's still in the pipeline. The list, as is the bot API, subject to change at any time since this is under intense development and certain parts of the API are still yet to be decided.

    Bucket List

    • [x] Bot gateway identification with intents support
    • [x] Correct user agent, properties and REST authentication
    • [x] Sending basic messages
    • [x] Event dispatching with NotificationCenter for message create and ready events
    • [x] Application command registration with a resultBuilder - supported application command types:
      • [x] chatInput - Slash commands
      • [ ] user - Actions that appear in context menu of users
      • [ ] message - Actions that appear in context menu of messages
    • [x] Adding options to commands in the resultBuilder - supported types:
      • [x] subCommand - A "sub-command" with no options
      • [ ] subCommandGroup - A group for nesting other options
      • [x] string - An option accepting a String value
      • [x] integer - An option accepting an Int value
      • [x] boolean - An option accepting a Bool value
      • [ ] user - An option accepting a user as its value
      • [ ] channel - An option accepting a channel as its value
      • [ ] role - An option accepting a role as its value
      • [ ] mentionable - An option accepting a @mention as its value
      • [x] number - An option accepting a Double value
      • [ ] attachment - An option accepting a file attachment as its value
    • [x] Handling interactions with a closure, allowing responses
    • [x] Support more types of interaction responses
      • [x] Plain content responses
      • [x] Ephemeral responses
      • [x] Embeds
        • [x] Construct fields with a resultBuilder
    • [ ] Utility methods for received messages/channels/etc.

    Guide

    WIP beginner-friendly guide for building a bot with DiscordKit is available!

    opened by cryptoAlgorithm 6
Releases(0.1.0)
  • 0.1.0(May 17, 2022)

    The initial release of DiscordKit. Currently, DiscordKit is tailor-made for Swiftcord, but it can also be used on its own or as a reference for another package.

    It supports most documented REST endpoints that use POST, GET or DELETE requests, as well as a very robust Gateway implementation, albeit only for human accounts.

    Source code(tar.gz)
    Source code(zip)
Owner
Swiftcord
Swiftcord - A fully native Discord client for macOS, built 100% in SwiftUI!
Swiftcord
Quotes App is quotes browsing app which is built with Quotable Free API completely in SwiftUI.

Quotes App is quotes browsing app which is built with Quotable Free API completely in SwiftUI. You can watch the whole journey of building this

Dheeraj Kumar Sharma 32 Nov 22, 2022
Quotes App - quotes browsing app which is built with Quotable Free API completely in UIKit

Quotes App is quotes browsing app which is built with Quotable Free API completely in UIKit

Mohammed Sulaiman 1 Jan 7, 2023
Don't start from scratch, start from Here! This is a starter project for iOS projects. It contains all the basic configurations and common libraries for your project.

Starter-iOS Don't start from scratch, start from Here! This is a starter project for iOS projects. It contains all the basic configurations and common

Shaban Kamel 6 May 24, 2022
Create a weather app from scratch with this SwiftUI Crash Course

"Create a weather app from scratch with this SwiftUI Crash Course" https://youtu

Alexey Saechnikov 0 Dec 17, 2021
Ios-desde-cero - Code, documents and resources used in the Stream iOS from scratch

iOS desde cero ¿Qué es esto? iOS desde Cero es un Streaming en ???? sobre desarr

Diego Freniche 36 Aug 22, 2022
WeChat-like Moments App implemented using Swift 5.5 and SwiftUI

Moments SwiftUI This is a re-implementation of Moments App using Swift 5.5 and SwiftUI. Features: Aysnc/Await Actor AysncImage MVVM BFF Screenshot Als

Jake Lin 46 Jan 5, 2023
Beers is a simple experimental app implemented using the new amazing SwiftUI.

Beers is a simple experimental app implemented using the new amazing SwiftUI. The app shows a list of beers fetched from Punk API

Chris 27 Dec 20, 2022
Implemented MVVM-C (Coordinator) architecture pattern for the project. Which is satisfying SOLID principles altogether. Protocol oriented development has been followed.

BreakingBad BreakingBad API doc Implemented MVVM-C (Coordinator) architecture pattern for the project. Which is satisfying SOLID principples altogethe

Dhruvik Rao 2 Mar 10, 2022
Orbit-swiftui - Orbit design system implemented in SwiftUI for iOS

Orbit is a SwiftUI component library which provides developers the easiest possi

Kiwi.com 37 Jan 3, 2023
Diagrams of Combine Publishers implemented with SwiftUI

CombineMarbles for iOS Diagrams of Combine Publishers implemented with SwiftUI Combine is a new library for composing asynchronous events over time (R

Antoine Garcia 53 Dec 11, 2021
This is a mastodon sample SwiftUI app implemented with the architecture of state management with normalized cache.

MastodonNormalizedCacheSample This is a mastodon sample SwiftUI app. This app is implemented with the architecture of state management with Normalized

null 5 Nov 27, 2022
SwiftUI & Combine app using MovieDB API. With a custom Flux (Redux) implementation.

MovieSwiftUI MovieSwiftUI is an application that uses the MovieDB API and is built with SwiftUI. It demos some SwiftUI (& Combine) concepts. The goal

Thomas Ricouard 6.2k Jan 8, 2023
Swift iPhone and iPad Client for Polls API, using Hyperdrive API client

Polls Client This is a Swift iPhone and iPad client for the Polls API - a simple application allowing users to view polls and vote in them. Polls is a

Apiary 34 Jul 15, 2022
Kinopoisk clone iOS app using Swift, TMDb API, Youtube API and SDWebImage.

?? Kinopoisk clone iOS app using Swift, TMDb API, Youtube API and SDWebImage. App mainly developed to learn about Swift(UIKit), working with JSON, using MVVM architectural pattern.

ofigensky 1 Aug 20, 2022
A SwiftUI app that fetch images from The Dog API and The Cat API

Cat-Or-Dog-App A SwiftUI app that fetch images from The Dog API and The Cat API, then classify the species of dogs or cats with confidence level. The

null 0 Oct 19, 2021
MovieAppSwiftUI - The Application is using TMDB API and Server API to reduce user searching movies resources time with search engine

MovieAppSwiftUI The Application is using TMDB API and Server API to reduce user searching movies resources time with search engine.This Application is

JackSon_tm.m 5 Oct 29, 2022
Swift implementation of the elm architecture (TEA)

Swiftea If you were looking for a something like this: TEA (The Elm Architecture) MVU (Model-View-Update) MVI (Model-View-Intent) Redux-like Flux-like

Dmitrii Cooler 10 Aug 30, 2022
SwiftWebUI - A demo implementation of SwiftUI for the Web

SwiftWebUI More details can be found on the related blog post at the Always Right Institute. At WWDC 2019 Apple announced SwiftUI. A single "cross pla

SwiftWebUI 3.8k Dec 28, 2022
SwiftUI implementation of Conway’s Game of Life — also known as “Life”.

Life Conway’s Game of Life SwiftUI implementation of Conway’s Game of Life — also known simply as “Life”. About I’m Martin, an indie dev from Berlin.

Martin Lexow 23 Jan 21, 2022