class

Slack

Inherits Reference / Object

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

Constants

VERSION = "0.1.0"

Constructors

new(token : String)
Source

Instance methods

channels

Channels in current Slack session.

Source
channels=(channels : Hash(String, Slack::Channel))

Channels in current Slack session.

Source
close

Close the websocket connection

Source
config
Source
config=(config)
Source
debug
Source
debug=(debug : Bool)
Source
me

Returns me, as the current slack user.

Source
me=(me : User | Nil)

Returns me, as the current slack user.

Source
on(event : Slack::Event.class, &cb : Slack, Slack::Event -> )

Binds a callback to event. Allows multiple bindings to event, and will be called in order of binding

Source
prefs

Preferences

Source
prefs=(prefs : JSON::Any | Nil)

Preferences

Source
run

Start Slack RTM event loop

Source
send(msg : String, to channel : String)

Send a message to slack

Source
send(msg : Slack::Message)

Send a message to slack

Source
socket

Websocket connection.

Source
socket=(socket : HTTP::WebSocket | Nil)

Websocket connection.

Source
users

List of users in current Slack.

Source
users=(users : Slack::Users)

List of users in current Slack.

Source
wss=(wss : String | Nil)
Source

Nested types