Class: Issola::Bot

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

Instance Method Summary collapse

Constructor Details

#initialize(token:) ⇒ Bot

Returns a new instance of Bot.



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

def initialize(token:)
  @bot = Discordrb::Bot.new(
    token:     token,
  )

  @command_handler = Command::Handler.new

  @bot.message(start_with: Config::Bot::COMMAND_PREFIX) do |event|
    @command_handler.handle(event)
  end
end

Instance Method Details

#invite_urlObject



17
18
19
# File 'lib/issola/bot.rb', line 17

def invite_url
  @bot.invite_url
end

#register(obj) ⇒ Object



21
22
23
# File 'lib/issola/bot.rb', line 21

def register(obj)
  obj.register(@command_handler)
end

#runObject



25
26
27
# File 'lib/issola/bot.rb', line 25

def run
  @bot.run
end