class Slack
- Slack
- Reference
- Object
Overview
Handles connecting and starting Slack websocket session and delegates slack events.
require "../src/slack.cr"
slack = Slack.new(token: ENV["SLACK_TOKEN"])
slack.on(Slack::Event::UserTyping) do |session, event|
puts "someone is typing 2"
end
slack.run
Defined in:
slack.crslack/event.cr
slack/events/hello.cr
slack/events/message.cr
slack/events/message/pinned_item.cr
slack/events/presence_change.cr
slack/events/reaction_added.cr
slack/events/ready.cr
slack/events/reconnect_url.cr
slack/events/star_added.cr
slack/events/unimplemented.cr
slack/events/user_change.cr
slack/events/user_typing.cr
slack/message.cr
slack/user.cr
slack/user/profile.cr
slack/users.cr
slack/util.cr:1
slack/util.cr:31
slack/version.cr
Constant Summary
-
VERSION =
"0.1.0"
Constructors
Instance Method Summary
-
#channels : Hash(String, Slack::Channel)
Channels in current Slack session.
-
#channels=(channels : Hash(String, Slack::Channel))
Channels in current Slack session.
-
#close
Close the websocket connection
- #config
- #config=(config)
- #debug : Bool
- #debug=(debug : Bool)
-
#me : User | Nil
Returns me, as the current slack user.
-
#me=(me : User | Nil)
Returns me, as the current slack user.
-
#on(event : Slack::Event.class, &cb : Slack, Slack::Event -> )
Binds a callback to event.
-
#prefs : JSON::Any | Nil
Preferences
-
#prefs=(prefs : JSON::Any | Nil)
Preferences
-
#run
Start Slack RTM event loop
-
#send(msg : String, to channel : String)
Send a message to slack
-
#send(msg : Slack::Message)
Send a message to slack
-
#socket : HTTP::WebSocket | Nil
Websocket connection.
-
#socket=(socket : HTTP::WebSocket | Nil)
Websocket connection.
-
#users : Slack::Users
List of users in current Slack.
-
#users=(users : Slack::Users)
List of users in current Slack.
- #wss : String | Nil
- #wss=(wss : String | Nil)
Constructor Detail
Instance Method Detail
Binds a callback to event. Allows multiple bindings to event, and will be called in order of binding