DiscordKit Guide
GitHub Repository
  • 👋Welcome
  • 🚀Getting Started
    • Creating a Project
      • Creating a bot using a SPM project (Recommended)
      • Creating a bot using an Xcode Project
    • Installation
    • Example Project
  • 🤖Creating a Bot
    • Getting off the Ground
    • Logging In
    • Registering Commands
    • Responding to Commands
    • Adding Command Options
    • Deploying on Linux
  • 🪦Legacy
    • Message Commands
  • ✨Enhancements
    • Logging
  • 📦Nitty-gritty
    • What's in the box?
    • Gateway
    • Event Dispatching
Powered by GitBook
On this page
  • Prerequisites
  • Creating a Swift CLI package
  1. Getting Started
  2. Creating a Project

Creating a bot using a SPM project (Recommended)

Don't have a project to use DiscordKit with? These instructions are for you!

PreviousCreating a ProjectNextCreating a bot using an Xcode Project

Last updated 2 years ago

Prerequisites

macOS
  • Latest version of Xcode (14.3 as of writing)

Linux
  • The latest Swift toolchain (5.8 as of writing)

    • If you are on Ubuntu or Debian, we recommend installing the swift toolchain using the unofficial apt repo. For more details, see

    • If you prefer, you can download and manually install the official packages from

  • A code editor of your choosing

    • We strongly recommend using VSCode with the "Swift" Extension by "Swift Server Work Group" if you're starting out with swift, although it's not required.

Creating a Swift CLI package

  1. Open a terminal window, then create a new directory for your project to live in, and then change directory into it:

mkdir MyWonderfulBot
cd MyWonderfulBot
  1. Create a new swift package with the following command (Don't forget the --type=executable otherwise you won't be able to run your bot)

swift package init --type=executable

And that's it! If you're using Xcode, open the Package.swift file so that Xcode knows to load the package. If you're using a different editor, such as VSCode, open the entire folder.

🚀
https://www.swiftlang.xyz/
https://www.swift.org/download/