char_reject.rb 864 B

1234567891011121314151617181920212223242526272829
  1. require './app/app_forms/app_form.rb'
  2. class CharacerRejection < ApplicationForm
  3. def self.process
  4. @process ||= Application.new('Character Rejection') do |event|
  5. # Save app and check emote confirmation
  6. app = event.message.embeds.first
  7. reactions = event.message.reactions
  8. if reactions[Emoji::CHECK]&.count.to_i > 1
  9. # Find user and create embed
  10. user = event.server.member(UID.match(app.description)[1])
  11. embed = rejected_app(event, :character)
  12. # Create responses
  13. reply = [
  14. BotResponse.new(destination: event.channel.id, embed: embed, timer: 5),
  15. BotResponse.new(destination: user.dm.id, embed: embed)
  16. ]
  17. # Delete message and reply
  18. event.message.delete
  19. reply
  20. end
  21. rescue StandardError => e
  22. error_embed(e.message)
  23. end
  24. end
  25. end