reject.rb 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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
  55. end
  56. def user_char_app(event)
  57. reactions = event.message.reactions
  58. app = event.message.embeds.first
  59. description = ""
  60. Emoji::CHAR_APP.each do |reaction|
  61. if reactions[reaction].count > 1
  62. m = CharApp::REJECT_MESSAGES[reaction].gsub("\n", " ")
  63. description += "\n#{m}"
  64. end
  65. end
  66. embed = Embed.new(
  67. title: "**Your application has been rejected!!**",
  68. color: ERROR,
  69. footer: {
  70. text: FTR
  71. },
  72. fields: [
  73. {
  74. name: "Listed reasons for rejection:",
  75. value: description
  76. },
  77. {
  78. name: MSG,
  79. value: "[Edit Your Application](#{Url::CHARACTER}#{app.footer.text})"
  80. }
  81. ]
  82. )
  83. embed
  84. end
  85. def user_img_app(event)
  86. reactions = event.message.reactions
  87. app = event.message.embeds.first
  88. description = ""
  89. Emoji::IMG_APP.each do |reaction|
  90. if reactions[reaction].count > 1
  91. m = ImgApp::REJECT_MESSAGES[reaction].gsub("\n", " ")
  92. description += "\n#{m}"
  93. end
  94. end
  95. description += "\n\n#{MSG}"
  96. embed = Embed.new(
  97. title: "**Your application has been rejected!!**",
  98. color: ERROR,
  99. footer: {
  100. text: FTR
  101. },
  102. fields: [
  103. {
  104. name: "Listed reasons for rejection:",
  105. value: description
  106. }
  107. ]
  108. )
  109. embed.thumbnail = { url: app.thumbnail.url } if app.thumbnail
  110. embed
  111. end
  112. def self_edit_embed(app, form)
  113. Embed.new(
  114. title: "Don't forget to resubmit!",
  115. color: ERROR,
  116. description: "[Edit the Application](#{form}#{app.footer.text})"
  117. )
  118. end
  119. def char_reactive(form, edit_url)
  120. Embed.new(
  121. title: "Your reactivation request has been declined!",
  122. color: ERROR,
  123. description: "[Edit the Application](#{form}#{edit_url})"
  124. )
  125. end