Explorar el Código

fix text raffles

Kylie Jo Swistak hace 5 años
padre
commit
99cdc4a2ae
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      app/commands/raffle.rb

+ 5 - 1
app/commands/raffle.rb

@@ -27,7 +27,11 @@ class RaffleCommand < BaseCommand
 
       # Pick winner and format
       winner = participants.sample
-      results = winner&.id ? "<@#{winner.id}>" : winner.capitalize
+      results = case winner
+                when String then winner.capitalize
+                else
+                  "<@#{winner.id}>"
+                end
 
       # Reply
       Embed.new(description: "#{results} has won the raffle!")