All Projects → Azoy → Sword

Azoy / Sword

Licence: mit
Discord library for Swift

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Sword

Swiftdiscord
Discord API Client for Swift
Stars: ✭ 103 (-37.95%)
Mutual labels:  discord-api, discord
Discordgo
(Golang) Go bindings for Discord
Stars: ✭ 2,582 (+1455.42%)
Mutual labels:  discord-api, discord
Serenity
A Rust library for the Discord API.
Stars: ✭ 1,387 (+735.54%)
Mutual labels:  discord-api, discord
Discord.js Menu
💬 Easily create Discord.js v12 embed menus with reactions and unlimited customizable pages.
Stars: ✭ 89 (-46.39%)
Mutual labels:  discord-api, discord
Discord.js
discord.js is a powerful Node.js module that allows you to easily interact with the Discord API.
Stars: ✭ 16,432 (+9798.8%)
Mutual labels:  discord-api, discord
Discord Rich Presence Tool
A C++/Qt program that lets you fill in your own custom Discord Rich Presence information for games and activities away from the PC.
Stars: ✭ 91 (-45.18%)
Mutual labels:  discord-api, discord
Discordpp
A Modularized C++ Library for the Discord API
Stars: ✭ 111 (-33.13%)
Mutual labels:  discord-api, discord
Discordrpcvs
An extension for Visual Studio 2017 that enables Discord Rich Presence.
Stars: ✭ 77 (-53.61%)
Mutual labels:  discord-api, discord
Discord.net
An unofficial .Net wrapper for the Discord API (http://discordapp.com)
Stars: ✭ 2,253 (+1257.23%)
Mutual labels:  discord-api, discord
Arikawa
A Golang library and framework for the Discord API.
Stars: ✭ 123 (-25.9%)
Mutual labels:  discord-api, discord
Client
A Typescript NodeJS library to interact with Discord's API, both Rest and Gateway.
Stars: ✭ 84 (-49.4%)
Mutual labels:  discord-api, discord
Discordcr
Minimalist Discord library for Crystal. (Still WIP, but usable)
Stars: ✭ 137 (-17.47%)
Mutual labels:  discord-api, discord
Nino
🔨 Advanced and cute moderation discord bot as an entry of Discord's Hack Week!
Stars: ✭ 78 (-53.01%)
Mutual labels:  discord-api, discord
Music Bot
Simple music bot with a full-blown queue system that is easy to understand
Stars: ✭ 102 (-38.55%)
Mutual labels:  discord-api, discord
Bot
A Discord bot for all your needs. With memes, utilities, moderation & more, Fire is the only bot you'll need.
Stars: ✭ 79 (-52.41%)
Mutual labels:  discord-api, discord
Discljord
A Clojure wrapper library for the Discord API, with full API coverage (except voice, for now), and high scalability
Stars: ✭ 111 (-33.13%)
Mutual labels:  discord-api, discord
Dimscord
A Discord Bot & REST Library for Nim.
Stars: ✭ 67 (-59.64%)
Mutual labels:  discord-api, discord
Basicbot
A basic example of a Discord Bot written in Python. (discord.py)
Stars: ✭ 73 (-56.02%)
Mutual labels:  discord-api, discord
Discord Panel
📊 User friendly dashboard/tool for discord bot developpers to manage servers
Stars: ✭ 116 (-30.12%)
Mutual labels:  discord-api, discord
Discord Haskell
Haskell library for writing Discord bots
Stars: ✭ 129 (-22.29%)
Mutual labels:  discord-api, discord

Sword - A Discord Library for Swift

Swift Version Build Status Tag

Requirements

  1. macOS, Linux, iOS, watchOS, tvOS (no voice for iOS, watchOS, or tvOS)
  2. Swift 4.0
  3. libsodium (if on macOS or Linux)

Installing libsodium

macOS

Installing libsodium is really easy on mac as long as you have homebrew. After that is installed, all you have to do is brew install libsodium. That's it!

Linux

This depends on the version of Ubuntu you are running, so I made a nice table here:

Ubuntu 14.04 Ubuntu 16.04
sudo -E add-apt-repository -y ppa:chris-lea/libsodium && sudo apt-get update && sudo apt-get install -y libsodium-dev sudo apt-get update && sudo apt-get install -y libsodium-dev

It's easier to copy and paste that command right into shell, and follow any on screen instructions if needed so.

Adding Sword

Swift Package Manager

In order to add Sword as a dependency, you must first create a Swift executable in a designated folder, like so swift package init --type executable. Then in the newly created Package.swift, open it and add Sword as a dependency

// swift-tools-version: 4.0

import PackageDescription

let package = Package(
    name: "yourswiftexecutablehere",
    dependencies: [
        .package(url: "https://github.com/Azoy/Sword", .branch("master"))
    ],
    targets: [
      .target(
        name: "yourswiftexecutablehere",
        dependencies: ["Sword"]
      )
    ]
)

After that, open Sources/main.swift and remove everything and replace it with the example below.

import Sword

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

bot.editStatus(to: "online", playing: "with Sword!")

bot.on(.messageCreate) { data in
  let msg = data as! Message

  if msg.content == "!ping" {
    msg.reply(with: "Pong!")
  }
}

bot.connect()

CocoaPods

Adding Sword to your iOS, watchOS, or tvOS application is easier than ever with CocoaPods. All you have to do is add Sword as a dependency to your Podfile, something like this:

target 'yourappnamehere' do
  use_frameworks!
  pod 'Sword'
end

Then all you have to do is pod install and you're ready to go.

Running the bot (SPM)

Build the libraries with swift build, then type swift run

Running the bot in Xcode (SPM)

To run the bot in Xcode, you first have to compile the libraries with swift build. Then to build the xcode project, type swift package generate-xcodeproj. Finally, type open yourswiftexecutablehere.xcodeproj, look at the top and follow the steps below

Step 1

Step 2

Step 3

Then click the play button!

Links

Documentation - (created with Jazzy)

Join the API Channel to ask questions!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].