class Twitch::Bot::Adapter::Terminal

This adapter connects the chat client to the terminal

Attributes

client[R]

Public Class Methods

new(client:) click to toggle source
# File lib/twitch/bot/adapter/terminal.rb, line 8
def initialize(client:)
  @client = client
end

Public Instance Methods

connect() click to toggle source
# File lib/twitch/bot/adapter/terminal.rb, line 12
def connect; end
join_channel(_channel) click to toggle source
# File lib/twitch/bot/adapter/terminal.rb, line 28
def join_channel(_channel); end
part_channel() click to toggle source
# File lib/twitch/bot/adapter/terminal.rb, line 30
def part_channel; end
read_data() click to toggle source
# File lib/twitch/bot/adapter/terminal.rb, line 16
def read_data
  read_message_from_terminal
end
send_data(data) click to toggle source
# File lib/twitch/bot/adapter/terminal.rb, line 24
def send_data(data)
  puts data
end
send_message(text) click to toggle source
# File lib/twitch/bot/adapter/terminal.rb, line 20
def send_message(text)
  send_data(text)
end
shutdown() click to toggle source
# File lib/twitch/bot/adapter/terminal.rb, line 14
def shutdown; end

Private Instance Methods

read_message_from_terminal() click to toggle source
# File lib/twitch/bot/adapter/terminal.rb, line 36
def read_message_from_terminal
  Twitch::Bot::Logger.debug "Waiting for input..."
  input = read_terminal
  Twitch::Bot::Message::UserMessage.new(
    text: input,
    user: client.channel.name,
  )
end
read_terminal() click to toggle source
# File lib/twitch/bot/adapter/terminal.rb, line 45
def read_terminal
  gets
end