This repository has been archived by the owner on Oct 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Home
Sketch edited this page Jun 26, 2022
·
2 revisions
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.
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 in depth examples can be found here