character.rb 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. def character_embed(character, image, member)
  2. fields = []
  3. user = "#{member.name}##{member.tag}"
  4. footer_text = "#{user} | #{character.active}"
  5. footer_text += " | #{character.rating}" if character.rating
  6. fields.push({name: 'Species', value: character.species, inline: true}) if character.species
  7. fields.push({name: 'Type', value: character.types, inline: true}) if character.types
  8. fields.push({name: 'Age', value: character.age, inline: true}) if character.age
  9. fields.push({name: 'Weight', value: character.weight, inline: true}) if character.weight
  10. fields.push({name: 'Height', value: character.height, inline: true}) if character.height
  11. fields.push({name: 'Gender', value: character.gender, inline: true}) if character.gender
  12. fields.push({name: 'Sexual Orientation', value: character.orientation, inline: true}) if character.orientation
  13. fields.push({name: 'Relationship Status', value: character.relationship, inline: true}) if character.relationship
  14. fields.push({name: 'Hometown', value: character.hometown, inline: true}) if character.hometown
  15. fields.push({name: 'Location', value: character.location, inline: true}) if character.location
  16. fields.push({name: 'Attacks', value: character.attacks}) if character.attacks
  17. fields.push({name: 'Likes', value: character.likes}) if character.likes
  18. fields.push({name: 'Dislikes', value: character.dislikes}) if character.dislikes
  19. fields.push({name: 'Warnings', value: character.warnings}) if character.warnings
  20. fields.push({name: 'Rumors', value: character.rumors}) if character.rumors
  21. fields.push({name: 'Backstory', value: character.backstory}) if character.backstory
  22. fields.push({name: 'Other', value: character.other}) if character.other
  23. fields.push({name: 'DM Notes', value: character.dm_notes}) if character.dm_notes
  24. embed = Embed.new(
  25. footer: {
  26. icon_url: member.avatar_url,
  27. text: footer_text
  28. },
  29. title: character.name,
  30. fields: fields
  31. )
  32. embed.description = character.personality if character.personality
  33. embed.thumbnail = { url: image } if image
  34. embed.color = member.color.combined if member.color.combined
  35. embed
  36. end
  37. def char_image_embed(character_name, image, user)
  38. user_name = "#{user.name}##{user.tag}"
  39. Embed.new(
  40. footer: {
  41. icon_url: user.avatar_url,
  42. text: "#{user_name} | #{image.keyword} | #{image.category}"
  43. },
  44. title: character_name,
  45. image: {
  46. url: image.url
  47. }
  48. )
  49. end