reject.rb 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. def reject_char_embed(app)
  2. image_url = /\*\*URL to the Character\'s Appearance\*\*\:\s(.*)/.match(app)
  3. fields = []
  4. CharAppResponses::REJECT_MESSAGES.map do |emoji, message|
  5. fields.push({
  6. name: emoji,
  7. value: "#{message}\n#{CharAppResponses::INLINE_SPACE}",
  8. inline: true
  9. })
  10. end
  11. instructions =
  12. "#{Emoji::CHECK} : Indicates you are ready to send the corresponding " +
  13. "messages to the user\n" +
  14. "#{Emoji::CROSS} : Indicates you want to dismiss this message and " +
  15. "not send a message to the user\n" +
  16. "#{Emoji::CRAYON} : Indicates you want to edit the users form for them," +
  17. " and resubmit on their behalf"
  18. fields.push({
  19. name: "Submitting",
  20. value: instructions
  21. })
  22. embed = Embed.new(
  23. title: "**_APPLICATION REJECTED_**",
  24. description: "Please indicate what message to forward to the user!",
  25. color: Color::ERROR,
  26. fields: fields
  27. )
  28. embed.thumbnail = { url: image_url[1] } if image_url
  29. embed
  30. end
  31. def message_user_embed(event)
  32. reactions = event.message.reactions
  33. content = event.message.content
  34. edit_url = Regex::EDIT_URL.match(content)
  35. description = ""
  36. Emoji::APP_SECTIONS.each do |reaction|
  37. if reactions[reaction].count > 1
  38. m = CharAppResponses::REJECT_MESSAGES[reaction].gsub("\n", " ")
  39. description += "\n#{m}"
  40. end
  41. end
  42. embed = Embed.new(
  43. title: "**Your application has been rejected!!**",
  44. color: Color::ERROR,
  45. fields: [
  46. {
  47. name: "Listed reasons for rejection:",
  48. value: description
  49. },
  50. {
  51. name: "You can edit your application and resubmit here:",
  52. value: "#{Url::CHARACTER}#{edit_url[1]}"
  53. }
  54. ]
  55. )
  56. embed
  57. end
  58. def self_edit_embed(content)
  59. edit_url = Regex::EDIT_URL.match(content)
  60. Embed.new(
  61. title: "Please edit the user's application and resubmit!",
  62. color: Color::ERROR,
  63. description: "#{Url::CHARACTER}#{edit_url[1]}"
  64. )
  65. end