reject.rb 3.5 KB

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