Class: TelegramMeetupBot::Commands::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/telegram_meetup_bot/commands/factory.rb

Class Method Summary collapse

Class Method Details

.build(message) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/telegram_meetup_bot/commands/factory.rb', line 5

def build(message)
  return if BLACK_LIST.include?(message.command)

  if no_username?(message)
    TelegramMeetupBot::Commands::NilUsername.new(message)
  else
    klass(message.command).new(message)
  end
end