class Galileo::Client

Overview

Base dogehouse cilent to interface with api with

Defined in:

galileo/client.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(token : String, refresh_token : String) #

Client takes your dogehouse token and refreshToken in order to auth


[View source]

Instance Method Detail

def all_callback : String -> Nil | Nil #

All messages will be sent through this callback.

client.on_all do |msg|
  puts msg
end

[View source]
def all_callback=(all_callback : String -> Nil | Nil) #

All messages will be sent through this callback.

client.on_all do |msg|
  puts msg
end

[View source]
def ask_to_speak #

Ask to speak will request to speak in whatever room the bot is in


[View source]
def auth #

[View source]
def create_room(name : String, description : String = "", privacy : String = "public") #

Will create room with given name description and privacy option Privacy options are limited to "public" and "private"


[View source]
def delay : Int32 #

The chat delay withing rooms (measured in nanoseconds)


[View source]
def delay=(delay : Int32) #

The chat delay withing rooms (measured in nanoseconds)


[View source]
def get_rooms #

[View source]
def in_room : Bool #

True if bot in room, False if not


[View source]
def in_room=(in_room : Bool) #

True if bot in room, False if not


[View source]
def join_room(roomId : String) #

Join room will join the room associated with a roomId

client.join_room "roomid"

[View source]
def join_room_callback : Room -> Nil | Nil #

When room is joined this callback will be called

client.on_room_join do |room|
  puts room.name
end

[View source]
def join_room_callback=(join_room_callback : Room -> Nil | Nil) #

When room is joined this callback will be called

client.on_room_join do |room|
  puts room.name
end

[View source]
def message_callback : Message -> Nil | Nil #

Optional message_callback property Add a message callback function with .on_message

client.on_message do |msg|
  puts msg
end

[View source]
def message_callback=(message_callback : Message -> Nil | Nil) #

Optional message_callback property Add a message callback function with .on_message

client.on_message do |msg|
  puts msg
end

[View source]
def mute #

Will mute


[View source]
def muted : Bool #

True if bot is muted, False if not


[View source]
def muted=(muted : Bool) #

True if bot is muted, False if not


[View source]
def new_tokens_callback : String, String -> Nil | Nil #

If newtokens are passed this callback will be called

client.on_new_tokens do |token, refresh_token|
  puts token
end

[View source]
def new_tokens_callback=(new_tokens_callback : String, String -> Nil | Nil) #

If newtokens are passed this callback will be called

client.on_new_tokens do |token, refresh_token|
  puts token
end

[View source]
def on_all(&block : String -> Nil) #

Add all callback All messages recieved in the client will be sent through this callback

client.on_all do |msg|
  puts msg
end

[View source]
def on_message(&block : Message -> Nil) #

Add a message callback on_message takes block with context parameter and String parameter

client.on_message do |msg|
  puts msg
end

[View source]
def on_new_tokens(&block : String, String -> Nil) #

Add new tokens callback

client.on_new_tokens do |token, refresh_token|
  puts token
end

[View source]
def on_ready(&block : User -> Nil) #

Add ready callback

client.on_ready do |user|
  puts user.display_name
end

[View source]
def on_room_join(&block : Room -> Nil) #

Add room join callback

client.on_room_join do |room|
  puts room.name
end

[View source]
def on_user_joined_room(&block : User -> Nil) #

Add user joined room callback

client.on_user_joined_room do |user|
  puts user.display_name
end

[View source]
def raw_send(msg) #

Send raw messages api without wrapper


[View source]
def ready_callback : User -> Nil | Nil #

Optional on ready callback property

client.on_ready do |user|
  puts user.display_name
end

[View source]
def ready_callback=(ready_callback : User -> Nil | Nil) #

Optional on ready callback property

client.on_ready do |user|
  puts user.display_name
end

[View source]
def rooms : Array(Room) #

Returns all the available rooms in array Updated every 2 seconds


[View source]
def run #

Run the client This will start the message loop


[View source]
def send(message : String) #

Sends message to whatever room currently in

client.send_message "msg"

[View source]
def set_role(role : String, userId : String | Nil) #

Takes a role "raised_hand", "listener", "speaker" and an optional userId which will default to the bot userId


[View source]
def set_speaking(b : Bool) #

[View source]
def speaking : Bool #

If bot is speaking will be true else will be false


[View source]
def toggle_mute #

Will toggle mute on and off


[View source]
def unmute #

Will unmute


[View source]
def user_joined_room_callback : User -> Nil | Nil #

If a user joins a room this callback will be called

client.on_user_joined_room do |user|
  puts user.display_name
end

[View source]
def user_joined_room_callback=(user_joined_room_callback : User -> Nil | Nil) #

If a user joins a room this callback will be called

client.on_user_joined_room do |user|
  puts user.display_name
end

[View source]
def ws : HTTP::WebSocket #

Websocket connection state


[View source]
def ws=(ws : HTTP::WebSocket) #

Websocket connection state


[View source]