Module: Discordrb::Games

Defined in:
lib/discordrb/games.rb

Defined Under Namespace

Classes: Game

Class Method Summary collapse

Class Method Details

.find_game(name_or_id) ⇒ Object



327
328
329
330
331
332
333
# File 'lib/discordrb/games.rb', line 327

def find_game(name_or_id)
  return name_or_id if name_or_id.is_a? Game
  @games.each do |game|
    return game if game.name == name_or_id || game.id == name_or_id || game.id.to_s == name_or_id
  end
  nil
end