hello.rb 735 B

12345678910111213141516171819202122232425262728
  1. require './app/commands/base_command.rb'
  2. class HelloCommand < BaseCommand
  3. def self.cmd
  4. @cmd ||= Command.new(:hello, "Says hello!") do |event|
  5. author = event.author.nickname || event.author.name
  6. img = ImageUrl.find_by(name: 'happy')
  7. greetings = [
  8. "Hi there, #{author}",
  9. "Greetings #{author}, you lovable bum",
  10. "Alola, #{author}",
  11. "Hello, #{author}! The Guildmasters have been waiting",
  12. "#{author} would like to battle!"
  13. ]
  14. Embed.new(
  15. description: greetings.sample,
  16. color: event.author&.color&.combined,
  17. thumbnail: {
  18. url: img.url
  19. }
  20. )
  21. rescue StandardError => e
  22. error_embed(e.message)
  23. end
  24. end
  25. end