pvzig / slackkit Goto Github PK
View Code? Open in Web Editor NEWBuild Slack apps, in Swift
License: MIT License
Build Slack apps, in Swift
License: MIT License
It looks like SlackKit is caching every piece of information it sends / receives. For building a slackbot with SlackKit, I would not want it to hold all of this information in memory for its whole lifetime.
Could SlackKit have an option to disable this caching?
Kit doesn't have a means to get the channel history and load it into the client object
I actually need support for Attachments
in the app I'm working on. @muratayusuke's fork has this actually already done along with a bunch of other enhancements: muratayusuke@0baf74d
Would love to see a PR @muratayusuke to pull his fork's changes into upstream. If not I can always make a PR just for the Attachment
support but really it would just be duplicating @muratayusuke's efforts. Thoughts?
Did a pod update
today and got bumped from 3.1.5
to 3.1.8
But the pods/SlackKit
folder only contains the LICENSE and README.md files and nothing else.
I guess this commit 051e8dd removed the source reference and broke the pod, or am I missing something?
As soon as I add SlackKit as a dependency to the Package.swift
.Package(url: "https://github.com/pvzig/SlackKit.git", majorVersion: 3)
Everything works locally but when I try to deploy to heroku with this buildpack https://github.com/kylef/heroku-buildpack-swift
I have this error :
remote: Cloning into 'swiftenv'...
remote: -----> Installing 3.1
remote: Downloading https://swift.org/builds/swift-3.1-release/ubuntu1604/swift-3.1-RELEASE/swift-3.1-RELEASE-ubuntu16.04.tar.gz
remote: 3.1 has been installed.
remote: -----> Building Package
remote: fatal error: 'try!' expression unexpectedly raised an error: PackageModel.Package.Error.noManifest(baseURL: "https://github.com/pvzig/SlackKit.git", version: Optional("3.1.12")): file /home/buildnode/disk2/workspace/oss-swift-3.1-package-linux-ubuntu-16_04/swift/stdlib/public/core/ErrorType.swift, line 182
remote: Current stack trace:
remote: 0 libswiftCore.so 0x00007fcf10d3d6b0 swift_reportError + 120
remote: 1 libswiftCore.so 0x00007fcf10d57fc0 _swift_stdlib_reportFatalErrorInFile + 100
remote: 2 libswiftCore.so 0x00007fcf10b524dc <unavailable> + 1189084
remote: 3 libswiftCore.so 0x00007fcf10cea86d <unavailable> + 2861165
remote: 4 libswiftCore.so 0x00007fcf10b51cb6 <unavailable> + 1186998
remote: 5 libswiftCore.so 0x00007fcf10cf0780 <unavailable> + 2885504
remote: 6 libswiftCore.so 0x00007fcf10b520ef <unavailable> + 1188079
remote: 7 libswiftCore.so 0x00007fcf10cb1499 <unavailable> + 2626713
remote: 8 libswiftCore.so 0x00007fcf10b51cb6 <unavailable> + 1186998
remote: 9 libswiftCore.so 0x00007fcf10c6e610 specialized _assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never + 144
remote: 10 libswiftCore.so 0x00007fcf10b7add5 <unavailable> + 1355221
remote: 11 swift-build 0x00000000006602a1 <unavailable> + 2491041
remote: 12 swift-build 0x00000000006603c6 <unavailable> + 2491334
remote: 13 swift-build 0x00000000006419a3 <unavailable> + 2365859
remote: 14 swift-build 0x000000000065cf64 <unavailable> + 2477924
remote: 15 swift-build 0x00000000004591b1 <unavailable> + 364977
remote: 16 swift-build 0x00000000006411c5 <unavailable> + 2363845
remote: 17 swift-build 0x0000000000641ff8 <unavailable> + 2367480
remote: 18 swift-build 0x000000000069a3d1 <unavailable> + 2728913
remote: 19 swift-build 0x00000000006a0f2e <unavailable> + 2756398
remote: 20 swift-build 0x00000000006932ab <unavailable> + 2699947
remote: 21 swift-build 0x000000000069a276 <unavailable> + 2728566
remote: 22 swift-build 0x000000000040ebc6 <unavailable> + 60358
remote: 23 libc.so.6 0x00007fcf0ecb5740 __libc_start_main + 240
remote: 24 swift-build 0x000000000040e9c9 <unavailable> + 59849
remote: /app/tmp/buildpacks/822b0802119468f06d891dd13d628ac251c70c982dc0461740f44eb64bd549e9b12ac39c1b08ca21f1bcf3bab7c4479d5f984ef0c1564018412c1ad0ab6822fd/bin/steps/swift-build: line 3: 419 Illegal instruction swift build $SWIFT_BUILD_FLAGS --configuration "$SWIFT_BUILD_CONFIGURATION"
remote: ! Push rejected, failed to compile Swift app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
Any idea ? It drive me crazy…
I'm a bit confused how one would observe changes on the Client
. A callback api would be appreciated. Essentially when messages are handled my client, state changes and etc. how would one go about observing these changes in a controller?
Here's my code to start a RTM connection as per readme:
....
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate,MessageEventsDelegate {
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
....
let options = ClientOptions(pingInterval: 2, timeout: 5, reconnect: true)
let bot = SlackKit(withAPIToken:xoxp-xxxxxxxxx,clientOptions: options)
bot.onClientInitalization = { (client: Client) in
print(client)
print(client.connected)
DispatchQueue.main.async(execute: {
client.messageEventsDelegate = self
})
}
print(bot)
.....
// MARK: MessageEventsDelegate
func received(_ message: Message, client: Client) {
print(message)
}
func connected(_ client: Client) {
print(client)
}
client.connected is always returning false
what gives?
edit: ok I got the above code to work by adding this client.connect()
in the onClientInit block....
and it prints in the received func the last received msg....
but How do i receive all subsequent messages while the client is connected?
How do i properly call this function...
public func channelHistory(id: String, latest: String = "\(Date().timeIntervalSince1970)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((_ history: History)->Void)?, failure: FailureClosure?) {
history(.channelsHistory, id: id, latest: latest, oldest: oldest, inclusive: inclusive, count: count, unreads: unreads, success: {(history) in
success?(history)
}) {(error) in
failure?(error)
}
}
or
channelHistory(String, success: <((History) -> Void)?, failure: <WebAPI.FailureClosure?>)
I Have this...but not working.
open class RealmManager {
fileprivate init() {}
static let shared = RealmManager()
let slackWebApiClient = WebAPI(token:"xxxxxxxx")
........
func someFunction {
self.slackWebApiClient.channelHistory(res.destinationSlackChannelId, success: {(history: History) in
Log.info?.message("\(history)")
Log.info?.message("\(history.messages)")
}, failure:{ (error) in
print("SlackChannelHistory error:\(error.localizedDescription)")
})
...........
}
}
Hi,
Do you have compatibility with Objective-C?
Thanks
I'm having nothing but trouble getting it to run on my device without crashing with bad access violations. Debugging this in Xcode 8 really isn't providing much to go on. Just want to confirm that it does work for others in Xcode 8 / Swift 3 project.
This happens literally with just creating the SlackKit object with an API token. Looks like it can't process the initial messages from Slack. But not sure why.
Related note: Carthage build will not work for me either, so I pulled in the 3 projects into a workspace and am letting it build each that way. Seems to build ok, but just this weird on device issue (works ok in simulator).
SlackKit took near a half hour to archive in my project, working with a maxed out 2015 MacBook Pro. I'm not sure why it is taking so long.
I keep getting this error
and I've implemented all the methods from that protocol.
What gives....
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, MessageEventsDelegate,ConnectionEventsDelegate, SlackEventsDelegate{
func preferenceChanged(_ preference: String, value: Any?, client: Client){print(client)}
func userChanged(_ user: User, client: Client){print(client)}
func presenceChanged(_ user: User, presence: String, client: Client){print(client)}
func manualPresenceChanged(_ user: User, presence: String, client: Client){print(client)}
func botEvent(_ bot: Bot, client: Client){print(client)}
public func userTypingIn(_ channel: Channel, user: User, client: Client) {
print(user)
}
the other protocols' methods have been implemented in below un posted code...
I'm using following code, having connected successfully:
func userTypingIn(_ channel: Channel, user: User, client: Client) {
print("userTypingIn \(channel.name): \(user.name)")
}
However, in my logs, all I see is the following:
userTypingIn nil: nil
Hello!
Just updated to 2.0, migrated from previous version and faced a problem. I tried to initialize SlackKit with API Token of my bot, set the onClientInitalization block, but I realized, that onClientInitalization never get called. This block is nil in constructor body:
public init(withAPIToken token: String, clientOptions: ClientOptions = ClientOptions()) {}
That's why I can't get Client instance and set it's messageEventsDelegate. So, may be you will add onClientInitalization block as a parameter to costructor, or something like this?
Thank you!
Hi there! Just tried to install SlackKit using Swift Package Manager, and your Starscream fork declares a dependency of CDispatch
, which does not seem to be available anymore. Do you plan to update the fork, use the mainstream repository of the mentioned package, or is there a workaround on this issue?
Thanks!
Updating to version 3 breaks build
thanks!
bot.onClientInitalization = { (client: Client) in
DispatchQueue.main.async(execute: {
client.messageEventsDelegate = self
client.connectionEventsDelegate = self
//send client to object cache?
//put client somewhere to use it again elsewhere or
// try another design?
})
or should i really be doing webAPI stuff here...
func connected(_ client: Client) {
print("\(client.connected) \("connected FromForeground")")
//send client to object cache?
//put client somewhere to use it again elsewhere or
// try another design?
}
I see there's a few ways to get the initialized client object so that I can call WebAPI.
But how can I pass this object around the app and use it anywhere in the app?
Or is it cool to just do initialization again anywhere when I need the client object?
I'm having some issue with debugging using SlackKit.
If I create a simple project using Swift package manager, setting SlackKit as a dependency, I can compile / run the project with no issues, but autocomplete is broken. For example within the private func handleMessage(message: Message) method, "message" autocompletes to <>.
I also notice that if I put a breakpoint in that same method, none of the local variables are shown in the debugger, and if I try to po some of them it gives a bunch of warnings like this:
warning: Swift error in module robot-or-not-bot.
Debug info from this module will be unavailable in the debugger.
It would be great to start supporting the newest Swift, at least in a branch if not in master.
SlackKit currently lacks support for the team_profile events:
https://api.slack.com/events/team_profile_change
https://api.slack.com/events/team_profile_delete
https://api.slack.com/events/team_profile_reorder
Is it likely that using a dev API token will be counted as one of five (?) free integrations on a free Slack team's accounts?
I've been using SlackKit happily for a while now but have not found a satisfactory way to close the connection... is there a recommendation or best practice for this?
here are the informations i have :
CompileSwift normal x86_64 /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Client+EventDispatching.swift
cd /Users/kevin/swiftymanager/Pods
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Action.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Attachment.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/AttachmentField.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/AuthorizeRequest.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/AuthorizeResponse.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Bot.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Channel.swift -primary-file /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Client+EventDispatching.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Client+EventHandling.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Client+Utilities.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Client.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/ClientOptions.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Comment.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/CustomProfile.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/CustomProfileField.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/DoNotDisturbStatus.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Edited.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Event.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/EventDelegate.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Extensions.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/File.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/History.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/IncomingWebhook.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Item.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Message.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/MessageActionRequest.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/MessageActionResponder.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/MessageActionServer.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/NetworkInterface.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/OAuthResponse.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/OAuthServer.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Reaction.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Response.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Scope.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Server.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/SlackError.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/SlackKit.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Team.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/TeamIcon.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/Topic.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/User.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/UserGroup.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/WebAPI.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/WebhookRequest.swift /Users/kevin/swiftymanager/Pods/SlackKit/SlackKit/Sources/WebhookServer.swift -target x86_64-apple-macosx10.10 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I "/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/BuildProductsPath/Release/SlackKit" -F "/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/BuildProductsPath/Release/SlackKit" -F "/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/BuildProductsPath/Release/Starscream" -F "/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/BuildProductsPath/Release/Swifter" -g -import-underlying-module -module-cache-path /Users/kevin/Library/Developer/Xcode/DerivedData/ModuleCache -D COCOAPODS -serialize-debugging-options -Xcc "-I/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/Release/SlackKit.build/swift-overrides.hmap" -Xcc -iquote -Xcc "/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/Release/SlackKit.build/SlackKit-generated-files.hmap" -Xcc "-I/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/Release/SlackKit.build/SlackKit-own-target-headers.hmap" -Xcc "-I/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/Release/SlackKit.build/SlackKit-all-non-framework-target-headers.hmap" -Xcc -ivfsoverlay -Xcc "/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/all-product-headers.yaml" -Xcc -iquote -Xcc "/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/Release/SlackKit.build/SlackKit-project-headers.hmap" -Xcc "-I/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/BuildProductsPath/Release/SlackKit/include" -Xcc -I/Users/kevin/swiftymanager/Pods/Headers/Private -Xcc -I/Users/kevin/swiftymanager/Pods/Headers/Public -Xcc "-I/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/Release/SlackKit.build/DerivedSources/x86_64" -Xcc "-I/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/Release/SlackKit.build/DerivedSources" -Xcc -DPOD_CONFIGURATION_RELEASE=1 -Xcc -DCOCOAPODS=1 -Xcc -ivfsoverlay -Xcc "/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/Release/SlackKit.build/unextended-module-overlay.yaml" -Xcc -working-directory/Users/kevin/swiftymanager/Pods -emit-module-doc-path "/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/Release/SlackKit.build/Objects-normal/x86_64/Client+EventDispatching~partial.swiftdoc" -O -module-name SlackKit -emit-module-path "/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/Release/SlackKit.build/Objects-normal/x86_64/Client+EventDispatching~partial.swiftmodule" -serialize-diagnostics-path "/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/Release/SlackKit.build/Objects-normal/x86_64/Client+EventDispatching.dia" -emit-dependencies-path "/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/Release/SlackKit.build/Objects-normal/x86_64/Client+EventDispatching.d" -emit-reference-dependencies-path "/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/Release/SlackKit.build/Objects-normal/x86_64/Client+EventDispatching.swiftdeps" -o "/Users/kevin/Library/Developer/Xcode/DerivedData/Nicolaudie_Servers_Manager-gfouokmfcjroxgcirhcjgngkaahp/Build/Intermediates/ArchiveIntermediates/Nicolaudie Servers Manager/IntermediateBuildFilesPath/Pods.build/Release/SlackKit.build/Objects-normal/x86_64/Client+EventDispatching.o"
response["members"] is always failing to be cast as [String: Any] because it is an array of [String: Any]
I want to handle error when connecting.
But it seems nil
is passed to failure
parameter of webAPI.rtmStart
method in connect
function of Client
.
https://github.com/pvzig/SlackKit/blob/master/SlackKit/Sources/Client.swift#L95
So, if error happens in rtmStart
function ( like "no internet connection"), no message is send to delegate objects.
How can I handle webAPI error when connecting?
Is it possible to have client.send(message: String, channelID: String)
either throw
or return an error?
Models (like Client
, Channel
and other) have failable initializers init?
, but they do not return nil. Instead, they have all properties optional.
I wonder if the structs could have non-failable initializers instead, which would also affect types return in success closures - the result would not be an optional. And it would be easier to deal with the result in client applications.
If you are ok with the change, I could create a new PR.
I've been following the guide on https://medium.com/@pvzig/building-slack-bots-in-swift-b99e243e444c except I use version 3 of SlackKit. I can't deploy to Heroku because, it seems, Starscream uses the Security
module which does not exist:
git push heroku master
Counting objects: 35, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (31/31), done.
Writing objects: 100% (35/35), 5.21 KiB | 0 bytes/s, done.
Total 35 (delta 11), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Swift app detected
remote: Cloning into 'swiftenv'...
remote: -----> Installing 3.1
remote: Downloading https://swift.org/builds/swift-3.1-release/ubuntu1404/swift-3.1-RELEASE/swift-3.1-RELEASE-ubuntu14.04.tar.gz
remote: 3.1 has been installed.
remote: -----> Installing clang-3.7.0
remote: -----> Building Package
remote: Fetching https://github.com/skagedal/SlackKit.git
remote: Fetching https://github.com/httpswift/swifter
remote: Fetching https://github.com/daltoniam/Starscream
remote: Cloning https://github.com/skagedal/SlackKit.git
remote: Resolving https://github.com/skagedal/SlackKit.git at 3.1.13-skr
remote: Cloning https://github.com/daltoniam/Starscream
remote: Resolving https://github.com/daltoniam/Starscream at 2.0.4
remote: Cloning https://github.com/httpswift/swifter
remote: Resolving https://github.com/httpswift/swifter at 1.3.3
remote: Compile Swift Module 'Starscream' (2 sources)
remote: Compile Swift Module 'Swifter' (19 sources)
remote: /tmp/build_e8e90ff420f52f7a70a284ccea0500f4/.build/checkouts/Starscream-5563129366508893404/Source/SSLSecurity.swift:24:8: error: no such module 'Security'
remote: import Security
remote: ^
Hi,
I'm building a Slack Bot and when I try to send a text that contains the symbol >
, I got the value invalidArgName
in the failure
closure of client.webAPI.sendMessage
.
Example of code :
client.webAPI.sendMessage(myChannel, text: myMessage,
username: myUsername, asUser: true, linkNames: true,
iconEmoji: myEmoji, success: nil, failure: { (msg) in
print("send Error:\(msg)")
})
Output :
send Error:invalidArgName
I don't have this issue with other symbols (<
, @
, ...) and when I do the request with cURL, it works.
$> curl -X GET -H "Cache-Control: no-cache" -H "Postman-Token: $TOKEN" "https://slack.com/api/chat.postMessage?token=$TOKEN&channel=$CHANNEL&text=>&parse=full&link_names=1&unfurl_links=true&unfurl_media=false&username=$NAME&as_user=true&icon_url=&icon_emoji=$EMOJI"
{"ok":true,"channel":"$CHANNEL","ts":"xxxxxxxxxx.xxxxxx","message":{"type":"message","user":"$USER","text":"<","bot_id":"$BOTID","ts":"xxxxxxxxxx.xxxxxx"}}
Do you have an idea to resolve this?
Thanks!
Hello!
Is there an example anywhere demonstrating how to properly setup a slash command? I'm looking into using SlackKit
for this side project and I'm happy to append documentation and submit a PR. What exactly is the route
? When initializing the WebhookServer
? The token I'm assuming is the Verification Token
for your app. I'm using ngrok for now FYI.
Thanks for your help.
Is there a way to design an application client that doesn't use up an app integration towards the team's quota? It looks like that's the only way right now.
Migrate from using rtm.start
to rtm.connect
Hi Peter,
I'm working on a Slack bot sample project using your super SlackKit package from the linux branch. The thing is that my project, other than managing the websocket connection with SlackKit, it also need to expose a Rest Api.
I'm trying to use Zewo for the web server and basically using SlackClient and HTTPServer on two different dispatch queue but I'm always getting a Segmentation fault 11 error.
I had to fork your SlackKit repo and rename the SlackKit Message class as SlackMessage because of a conflict with Zero Message class.
Debugging I can see the crash is on CLibVenice library on releasing a probably not available autoreleasepool.
I've tried to add an autoreleasepool on the background queue but the problem persist. Any hint on this ?
If you want to take a look at the code both SlackKit fork and Bot sample are on my git repo:
Thanks a lot,
Jacopo
We're missing two reactions Web API endpoints:
reactions.get
reactions.list
Otherwise Xcode just hung trying to compile. Perhaps this will go away when shipping Xcode is Swift 2.2
any way to expose the HTTP header Retry After, in order to better handling throttling?
The below is from Slack FAQs...
The next rate limit is indicated by a HTTP header called Retry-After,
presented in seconds to wait before attempting another request.
If the value were 10, then you should wait 10 seconds or more before
retrying that request.
/Users/Shared/xxxx/frontend/apps/ios/xxxxx/Carthage/
Checkouts/slackkit/SlackKit/Sources/OAuthServer.swift:25:8:
error: no such module 'Swifter'
import Swifter
^
** BUILD FAILED **
I'm using zirinisp/slackkit branch: swift3-GM
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.