character.rb 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. def character_embed(character, image, user, color)
  2. fields = []
  3. footer_text = "#{user.name}##{user.tag} | #{character.active}"
  4. footer_text += " | #{character.rating}" if character.rating
  5. fields.push(
  6. { name: 'Species', value: character.species, inline: true }
  7. )if character.species
  8. fields.push(
  9. { name: 'Type', value: character.types, inline: true }
  10. )if character.types
  11. fields.push(
  12. { name: 'Age', value: character.age, inline: true }
  13. )if character.age
  14. fields.push(
  15. { name: 'Weight', value: character.weight, inline: true }
  16. )if character.weight
  17. fields.push(
  18. { name: 'Height', value: character.height, inline: true }
  19. )if character.height
  20. fields.push(
  21. { name: 'Gender', value: character.gender, inline: true }
  22. )if character.gender
  23. fields.push(
  24. { name: 'Sexual Orientation', value: character.orientation, inline: true }
  25. )if character.orientation
  26. fields.push(
  27. { name: 'Relationship Status', value: character.relationship, inline: true }
  28. )if character.relationship
  29. fields.push(
  30. { name: 'Hometown', value: character.hometown, inline: true }
  31. )if character.hometown
  32. fields.push(
  33. { name: 'Location', value: character.location, inline: true }
  34. )if character.location
  35. fields.push(
  36. { name: 'Attacks', value: character.attacks }
  37. )if character.attacks
  38. fields.push(
  39. { name: 'Likes', value: character.likes }
  40. )if character.likes
  41. fields.push(
  42. { name: 'Dislikes', value: character.dislikes }
  43. )if character.dislikes
  44. fields.push(
  45. { name: 'Warnings', value: character.warnings }
  46. )if character.warnings
  47. fields.push(
  48. { name: 'Rumors', value: character.rumors }
  49. )if character.rumors
  50. fields.push(
  51. { name: 'Backstory', value: character.backstory }
  52. )if character.backstory
  53. fields.push(
  54. { name: 'Other', value: character.other }
  55. )if character.other
  56. fields.push(
  57. { name: 'DM Notes', value: character.dm_notes }
  58. )if character.dm_notes
  59. embed = Embed.new(
  60. footer: {
  61. icon_url: user.avatar_url,
  62. text: footer_text
  63. },
  64. title: character.name,
  65. color: color,
  66. fields: fields
  67. )
  68. embed.description = character.personality if character.personality
  69. embed.thumbnail = { url: image } if image
  70. embed
  71. end
  72. def char_image_embed(char, image, user, color)
  73. footer = "#{user.name}##{user.tag} | #{char.active}" +
  74. " | #{image.category}"
  75. Embed.new(
  76. footer: {
  77. icon_url: user.avatar_url,
  78. text: footer
  79. },
  80. title: "#{char.name} | #{image.keyword}",
  81. color: color,
  82. image: {
  83. url: image.url
  84. }
  85. )
  86. end
  87. def image_list_embed(char, images, user, color)
  88. fields = []
  89. images.each do |img|
  90. fields.push({name: img.keyword, value: img.url})
  91. end
  92. Embed.new(
  93. title: char.name,
  94. color: color,
  95. fields: fields,
  96. footer: {
  97. icon_url: user.avatar_url,
  98. text: "#{user.name}##{user.tag} | #{char.active}"
  99. }
  100. )
  101. end