reject.rb 3.4 KB

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