{"id":13410985,"url":"https://github.com/Azoy/Sword","last_synced_at":"2025-03-14T16:33:34.135Z","repository":{"id":49747254,"uuid":"76845492","full_name":"Azoy/Sword","owner":"Azoy","description":"Discord library for Swift","archived":true,"fork":false,"pushed_at":"2020-12-04T21:55:34.000Z","size":2161,"stargazers_count":180,"open_issues_count":10,"forks_count":53,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-04-26T01:00:49.554Z","etag":null,"topics":["discord","discord-api","swift"],"latest_commit_sha":null,"homepage":"https://azoy.github.io/Sword","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Azoy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-19T08:58:59.000Z","updated_at":"2023-08-01T22:29:41.000Z","dependencies_parsed_at":"2022-09-12T15:13:59.639Z","dependency_job_id":null,"html_url":"https://github.com/Azoy/Sword","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azoy%2FSword","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azoy%2FSword/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azoy%2FSword/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azoy%2FSword/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Azoy","download_url":"https://codeload.github.com/Azoy/Sword/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243610684,"owners_count":20319009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["discord","discord-api","swift"],"created_at":"2024-07-30T20:01:10.646Z","updated_at":"2025-03-14T16:33:33.651Z","avatar_url":"https://github.com/Azoy.png","language":"Swift","readme":"# Sword - A Discord Library for Swift\n\n[![Swift Version](https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat-square)](https://swift.org) [![Build Status](https://img.shields.io/travis/Azoy/Sword/master.svg?style=flat-square)](https://travis-ci.org/Azoy/Sword) [![Tag](https://img.shields.io/github/tag/Azoy/Sword.svg?style=flat-square\u0026label=release\u0026colorB=)](https://github.com/Azoy/Sword/releases)\n\n## Requirements\n1. macOS, Linux, iOS, watchOS, tvOS (no voice for iOS, watchOS, or tvOS)\n2. Swift 4.0\n3. libsodium (if on macOS or Linux)\n\n## Installing libsodium\n### macOS\nInstalling libsodium is really easy on mac as long as you have [homebrew](https://brew.sh). After that is installed, all you have to do is `brew install libsodium`. That's it!\n\n### Linux\nThis depends on the version of Ubuntu you are running, so I made a nice table here:\n\n| Ubuntu 14.04 | Ubuntu 16.04 |\n|:-----------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------:|\n| `sudo -E add-apt-repository -y ppa:chris-lea/libsodium \u0026\u0026 sudo apt-get update \u0026\u0026 sudo apt-get install -y libsodium-dev` | `sudo apt-get update \u0026\u0026 sudo apt-get install -y libsodium-dev` |\n\nIt's easier to copy and paste that command right into shell, and follow any on screen instructions if needed so.\n\n## Adding Sword\n### Swift Package Manager\nIn 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\n\n```swift\n// swift-tools-version: 4.0\n\nimport PackageDescription\n\nlet package = Package(\n    name: \"yourswiftexecutablehere\",\n    dependencies: [\n        .package(url: \"https://github.com/Azoy/Sword\", .branch(\"master\"))\n    ],\n    targets: [\n      .target(\n        name: \"yourswiftexecutablehere\",\n        dependencies: [\"Sword\"]\n      )\n    ]\n)\n```\n\nAfter that, open Sources/main.swift and remove everything and replace it with the example below.\n\n```swift\nimport Sword\n\nlet bot = Sword(token: \"Your bot token here\")\n\nbot.editStatus(to: \"online\", playing: \"with Sword!\")\n\nbot.on(.messageCreate) { data in\n  let msg = data as! Message\n\n  if msg.content == \"!ping\" {\n    msg.reply(with: \"Pong!\")\n  }\n}\n\nbot.connect()\n```\n\n### CocoaPods\nAdding 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:\n\n```ruby\ntarget 'yourappnamehere' do\n  use_frameworks!\n  pod 'Sword'\nend\n```\n\nThen all you have to do is `pod install` and you're ready to go.\n\n## Running the bot (SPM)\nBuild the libraries with `swift build`, then type `swift run`\n\n## Running the bot in Xcode (SPM)\nTo 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\n\n![Step 1](images/step1.png)\n\n![Step 2](images/step2.png)\n\n![Step 3](images/step3.png)\n\nThen click the play button!\n\n## Links\n[Documentation](https://azoy.github.io/Sword/) - (created with [Jazzy](https://github.com/Realm/Jazzy))\n\nJoin the [API Channel](https://discord.gg/99a3xNk) to ask questions!\n","funding_links":[],"categories":["💻 API Libraries","Libraries"],"sub_categories":["Swift"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAzoy%2FSword","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAzoy%2FSword","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAzoy%2FSword/lists"}