status.rb 725 B

12345678910111213141516171819202122232425262728
  1. def status_list
  2. # Create Status lists
  3. # Split Statuses by stackable, and non-stackable, saving only their names
  4. stackable, non_stackable = Status.all.partition{ |s| s.amount }
  5. # Push the categorized Statuses into embed fields
  6. fields = []
  7. fields.push(
  8. { name: 'Stackable Effects', value: stackable.map(&:name).join(", ")}
  9. ) unless stackable.empty?
  10. fields.push(
  11. { name: 'Non-Stackable Effects', value: non_stackable.map(&:name).join(", ")}
  12. ) unless non_stackable.empty?
  13. # Create Embed
  14. Embed.new(
  15. title: 'Statuses',
  16. fields: fields
  17. )
  18. end
  19. def status_details(status)
  20. Embed.new(
  21. title: status.name,
  22. description: "#{status.effect.capitalize}\n(Stacks: #{status.amount})"
  23. )
  24. end