require_relative './session' require_relative './lesson' require_relative './commands' class Ika attr_reader :bot attr_reader :lessons, :sessions attr_accessor :current_lesson, :current_session def initialize(bot) @bot = bot @lessons = {} @sessions = {} @current_session = nil @current_lesson = Lesson.new end def start! bot.remove_handler @message_handler if @message_handler @message_handler = bot.message do |message| handle_message message end bot.run # you can run this in the background, idk end def stop! bot.remove_handler @message_handler if @message_handler end def current_lesson_running? current_lesson.running? end def start_lesson!(message) current_lesson.start!(message.channel) end def stop_current_lesson! current_lesson.stop! end def handle_message(message) if command = Commands::Command.for(self, message) command.execute end return current_session&.respond_to message end end