item.rb 674 B

1234567891011121314151617181920212223242526272829
  1. def item_embed(item, event)
  2. # Find the author, if they're a member, or in DMs use the event's author
  3. member = item.user_id.match(/public/i) ? 'Public' :
  4. event.server.member(item.user_id)
  5. fields = []
  6. embed = Embed.new(
  7. title: item.name,
  8. description: item.description,
  9. )
  10. embed.thumbnail = { url: item.url } if item.url
  11. author_footer(
  12. embed,
  13. member,
  14. [item.category.join(", "), item.reusable ? 'Reusable' : 'Not Resuable']
  15. )
  16. fields.push({ name: 'Effect', value: item.effect }) if item.effect
  17. embed.fields = fields
  18. embed
  19. end
  20. def item_list
  21. Embed.new(
  22. title: 'Items',
  23. description: Item.all.map(&:name).join(", ")
  24. )
  25. end