Class: HexTokenBot::BotServer

Inherits:
Object
  • Object
show all
Defined in:
lib/hex_token_bot/bot_server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBotServer

Returns a new instance of BotServer.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/hex_token_bot/bot_server.rb', line 8

def initialize

  scheduler = Rufus::Scheduler.new

  HexTokenBot.bots.each do |bot|
    case bot['bot_name']
      when 'bot_auto_trans'
        when_ever = bot['bot_params']['when_ever']
        HexTokenBot::Bots::BotAutoTrans.set(:name, bot['bot_name'])
        scheduler.every when_ever||'3s', :tag => bot['bot_name'] do
          puts 'Hello... Bots'
          HexTokenBot::Bots::BotAutoTrans.set(:channels, bot['bot_data_channels'])
          HexTokenBot::Bots::BotAutoTrans.set(:markets, bot['bot_markets'])
          HexTokenBot::Bots::BotAutoTrans.run!
        end
    end
  end
end

Instance Attribute Details

#bot_serversObject

Returns the value of attribute bot_servers.



6
7
8
# File 'lib/hex_token_bot/bot_server.rb', line 6

def bot_servers
  @bot_servers
end

#schedulerObject

Returns the value of attribute scheduler.



5
6
7
# File 'lib/hex_token_bot/bot_server.rb', line 5

def scheduler
  @scheduler
end

Instance Method Details

#run!Object



27
28
29
30
31
32
# File 'lib/hex_token_bot/bot_server.rb', line 27

def run!
  while true
    puts ".."
    sleep(2)
  end
end