Skip to content
This repository was archived by the owner on May 31, 2021. It is now read-only.

Commit

Permalink
Attempt to fix iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Azoy committed Sep 6, 2017
1 parent 025b786 commit 051bb59
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ To run the bot in Xcode, you first have to compile the libraries with `swift bui
Then click the play button!

# Links
[Documentation](http://sword.azoy.gg) - (created with [Jazzy](https://github.com/Realm/Jazzy))
[Documentation](http://sword.azoy.me) - (created with [Jazzy](https://github.com/Realm/Jazzy))

Join the [API Channel](https://discord.gg/q7Zyd2r) to ask questions!
7 changes: 7 additions & 0 deletions Sources/Sword/Gateway/EventHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,20 @@ extension Shard {

self.sword.emit(.voiceStateUpdate, with: userId)


#if !os(iOS)
guard userId == self.sword.user!.id else { return }

if let channelId = channelId {
self.sword.voiceManager.guilds[guildId] = PotentialConnection(channelId: channelId, userId: userId, sessionId: sessionId)
}else {
self.sword.voiceManager.leave(guildId)
}
#endif

/// VOICE_SERVER_UPDATE
case .voiceServerUpdate:
#if !os(iOS)
let guildId = GuildID(data["guild_id"] as! String)!
let token = data["token"] as! String
let endpoint = data["endpoint"] as! String
Expand All @@ -325,6 +329,9 @@ extension Shard {
)

self.sword.voiceManager.join(guildId, endpoint, payload)
#else
break
#endif


case .audioData:
Expand Down
3 changes: 3 additions & 0 deletions Sources/Sword/Gateway/Gateway.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ extension Gateway {

self.session?.onConnect = { [unowned self] in
self.isConnected = true

#if !os(iOS)
self.handleConnect()
#endif
}

self.session?.onText = { [unowned self] text in
Expand Down
4 changes: 4 additions & 0 deletions Sources/Sword/Rest/MultipartBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

#if !os(Linux)
import Foundation

#if os(iOS)
import MobileCoreServices
#endif

/// Image Handler
extension Sword {
Expand Down
3 changes: 1 addition & 2 deletions Sources/Sword/Shield/Shield.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ open class Shield: Sword {
let originalCommand = commandString
commandString = commandString.lowercased()

// Replace an alias with the string for the base command if it exists
if (self.commands[commandString] == nil) {
if self.commands[commandString] == nil {
if let alias = self.commandAliases[commandString] {
commandString = alias
}
Expand Down

0 comments on commit 051bb59

Please sign in to comment.