poll.rb 503 B

1234567891011121314151617181920212223
  1. def new_poll(event, question, choices)
  2. fields = []
  3. choices.each.with_index do |c, i|
  4. fields.push({
  5. name: "#{Emoji::LETTERS[i]} #{c}",
  6. value: CharApp::INLINE_SPACE,
  7. inline: true
  8. })
  9. end
  10. embed = Embed.new(
  11. title: question,
  12. author: {
  13. name: event.author.nickname || event.author.name,
  14. icon_url: event.author.avatar_url
  15. },
  16. fields: fields
  17. )
  18. embed.color = event.author.color.combined if event.author.color
  19. embed
  20. end