Module: Elephrame::Streaming

Included in:
Bots::Command, Bots::GenerativeBot, Bots::Interact, Bots::PeriodInteract, Bots::Reply, Bots::TraceryBot, Bots::Watcher
Defined in:
lib/elephrame/streaming/streaming.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#streamerObject (readonly)

Returns the value of attribute streamer.



8
9
10
# File 'lib/elephrame/streaming/streaming.rb', line 8

def streamer
  @streamer
end

Instance Method Details

#setup_streamingObject

Creates the stream client



13
14
15
16
17
18
19
# File 'lib/elephrame/streaming/streaming.rb', line 13

def setup_streaming
  stream_uri = @client.instance
                 .attributes['urls']['streaming_api']
                 .gsub(/^wss?/, 'https')
  @streamer = Mastodon::Streaming::Client.new(base_url: stream_uri,
                                              bearer_token: ENV['TOKEN'])
end