Class: DiscordDistanceCalculator::Bot

Inherits:
Object
  • Object
show all
Defined in:
lib/discord_distance_calculator/bot.rb

Class Method Summary collapse

Class Method Details

.startObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/discord_distance_calculator/bot.rb', line 4

def self.start
  bot = Discordrb::Bot.new token: ENV['DISCORD_TOKEN'] , client_id: ENV['DISCORD_CLIENT_ID']
  puts "This bot's invite URL is #{bot.invite_url}."

  bot.message do |event|
    handler = DiscordDistanceCalculator::MessageHandler.new(event.message.to_s)
    event.respond handler.get_response
  end

  bot.run
end