reject.rb 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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({ name: emoji, value: "#{message}\n#{CharAppResponses::INLINE_SPACE}", inline: true })
  6. end
  7. fields.push({ name: "Submitting", value: "#{Emoji::CHECK} : Indicates you are ready to send the corresponding messages to the user\n#{Emoji::CROSS} : Indicates you want to dismiss this message and not send a message to the user\n#{Emoji::CRAYON} : Indicates you want to edit the users form for them, and resubmit on their behalf" })
  8. embed = Embed.new(
  9. title: "**_APPLICATION REJECTED_**",
  10. description: "Please indicate what message to forward to the user!",
  11. color: Color::ERROR,
  12. fields: fields
  13. )
  14. embed.thumbnail = { url: image_url[1] } if image_url
  15. embed
  16. end
  17. def message_user_embed(event)
  18. reactions = event.message.reactions
  19. content = event.message.content
  20. edit_url = Regex::EDIT_URL.match(content)
  21. description = ""
  22. Emoji::APP_SECTIONS.each do |reaction|
  23. if reactions[reaction].count > 1
  24. m = CharAppResponses::REJECT_MESSAGES[reaction].gsub("\n", " ")
  25. description += "\n#{m}"
  26. end
  27. end
  28. embed = Embed.new(
  29. title: "**Your application has been rejected!!**",
  30. color: Color::ERROR,
  31. fields: [
  32. { name: "Listed reasons for rejection:", value: description },
  33. { name: "You can edit your application and resubmit here:", value: "#{Url::CHARACTER}#{edit_url[1]}" }
  34. ]
  35. )
  36. embed
  37. end
  38. def self_edit_embed(content)
  39. edit_url = Regex::EDIT_URL.match(content)
  40. Embed.new(
  41. title: "Please edit the user's application and resubmit!",
  42. color: Color::ERROR,
  43. description: "#{Url::CHARACTER}#{edit_url[1]}"
  44. )
  45. end