Skip to content
This repository has been archived by the owner on Oct 15, 2023. It is now read-only.
Sketch edited this page Jun 26, 2022 · 2 revisions

Welcome to the Swiftcord wiki!

Swiftcord is a wrapper for Discord's Bot API. It aims to be clean and simple as possible.

Here you can find examples on how to use the many features Swiftcord provides.

If you would like to contribute to the wiki, contact Sketch#4374 on Discord.

Basic Message Listener

import Swiftcord

let bot = Swiftcord(token: "Your bot token here")

// Set activity if wanted
let activity = Activities(name: "with Swiftcord!", type: .playing)
bot.editStatus(status: .online, activity: activity)

// Set intents which are required for listening to messages
bot.setIntents(intents: .guildMessages)

class MyBot: ListenerAdapter {
  override func onMessageCreate(event: Message) async {
    if msg.content == "!ping" {
      try! await msg.reply(with: "Pong!")
    }
  }
}

bot.addListeners(MyBot())
bot.connect()

More Examples

More in depth examples can be found here

Clone this wiki locally