reject.rb 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. MSG = "Please resubmit when you've addressed the issues!\n"
  2. FTR = "If you have any questions, feel free to ask a Guildmaster"
  3. def reject_char_embed(app)
  4. fields = []
  5. app.fields.each do |f|
  6. fields.push({ name: f.name, value: f.value, inline: true })
  7. end
  8. fields.push({ name: "\u200b", value: "\u200b" })
  9. CharApp::REJECT_MESSAGES.map do |emoji, message|
  10. fields.push({
  11. name: emoji,
  12. value: "#{message}\n#{CharApp::INLINE_SPACE}",
  13. inline: true
  14. })
  15. end
  16. instructions =
  17. "#{Emoji::CHECK} : Indicates you are ready to send the corresponding " +
  18. "messages to the user\n" +
  19. "#{Emoji::CROSS} : Indicates you want to dismiss this message and " +
  20. "not send a message to the user\n" +
  21. "#{Emoji::CRAYON} : Indicates you want to edit the users form for them," +
  22. " and resubmit on their behalf"
  23. fields.push({
  24. name: "Submitting",
  25. value: instructions
  26. })
  27. embed = Embed.new(
  28. title: app.title,
  29. description: app.description,
  30. author: {
  31. name: app.author.name.gsub('Application', 'Rejection'),
  32. icon_url: app.author.icon_url
  33. },
  34. color: Color::ERROR,
  35. footer: {
  36. text: app.footer.text
  37. },
  38. fields: fields
  39. )
  40. embed.thumbnail.url = app.thumbnail.url if app.thumbnail
  41. embed
  42. end
  43. def reject_img_embed(app)
  44. fields = []
  45. app.fields.each do |f|
  46. fields.push({ name: f.name, value: f.value, inline: true })
  47. end
  48. fields.push({ name: "\u200b", value: "\u200b" })
  49. ImgApp::REJECT_MESSAGES.map do |emoji, message|
  50. fields.push({
  51. name: emoji,
  52. value: "#{message}\n#{ImgApp::INLINE_SPACE}",
  53. inline: true
  54. })
  55. end
  56. instructions =
  57. "#{Emoji::CHECK} : Indicates you are ready to send the corresponding " +
  58. "messages to the user\n" +
  59. "#{Emoji::CROSS} : Indicates you want to dismiss this message and " +
  60. "not send a message to the user\n"
  61. fields.push({
  62. name: "Submitting",
  63. value: instructions
  64. })
  65. Embed.new(
  66. title: app.title,
  67. description: app.description,
  68. author: {
  69. name: app.author.name.gsub('Application', 'Rejection'),
  70. icon_url: app.author.icon_url
  71. },
  72. thumbnail: {
  73. url: app.image.url
  74. },
  75. color: Color::ERROR,
  76. footer: {
  77. text: app.footer.text
  78. },
  79. fields: fields
  80. )
  81. end
  82. def user_char_app(event)
  83. reactions = event.message.reactions
  84. app = event.message.embeds.first
  85. description = ""
  86. Emoji::CHAR_APP.each do |reaction|
  87. if reactions[reaction].count > 1
  88. m = CharApp::REJECT_MESSAGES[reaction].gsub("\n", " ")
  89. description += "\n#{m}"
  90. end
  91. end
  92. embed = Embed.new(
  93. title: "**Your application has been rejected!!**",
  94. color: Color::ERROR,
  95. footer: {
  96. text: FTR
  97. },
  98. fields: [
  99. {
  100. name: "Listed reasons for rejection:",
  101. value: description
  102. },
  103. {
  104. name: MSG,
  105. value: "[Edit Your Application](#{Url::CHARACTER}#{app.footer.text})"
  106. }
  107. ]
  108. )
  109. embed
  110. end
  111. def user_img_app(event)
  112. reactions = event.message.reactions
  113. app = event.message.embeds.first
  114. description = ""
  115. Emoji::IMG_APP.each do |reaction|
  116. if reactions[reaction].count > 1
  117. m = ImgApp::REJECT_MESSAGES[reaction].gsub("\n", " ")
  118. description += "\n#{m}"
  119. end
  120. end
  121. description += "\n\n#{MSG}"
  122. embed = Embed.new(
  123. title: "**Your application has been rejected!!**",
  124. color: Color::ERROR,
  125. footer: {
  126. text: FTR
  127. },
  128. fields: [
  129. {
  130. name: "Listed reasons for rejection:",
  131. value: description
  132. }
  133. ]
  134. )
  135. embed.thumbnail.url = app.thumbnail.url if app.thumbnail
  136. embed
  137. end
  138. def self_edit_embed(app)
  139. Embed.new(
  140. title: "Don't forget to resubmit!",
  141. color: Color::ERROR,
  142. description: "[Edit the Application](#{Url::CHARACTER}#{app.footer.text})"
  143. )
  144. end