瀏覽代碼

Fix error with archiving characters not in a team

Kylie Jo Swistak 5 年之前
父節點
當前提交
a43c86bd88
共有 1 個文件被更改,包括 7 次插入7 次删除
  1. 7 7
      app/commands/app.rb

+ 7 - 7
app/commands/app.rb

@@ -70,18 +70,18 @@ class ApplicationCommand < BaseCommand
       # Check if character is in team
       in_team = CharTeam.where(active: true, char_id: character.id)
 
-      if in_team
-        teams = Team.where(id: in_team.map(&:team_id)).map(&:name)
-        embed = team_alert(character, teams)
-
-        BotResponse.new(embed: embed, reactions: Emoji::REQUEST)
-      else
+      if in_team.empty?
         character.update(active: 'Archived')
         character.reload
 
         embed = success_embed("Successfully archived #{character.name}")
         [ BotResponse.new(destination: ENV['APP_CH'], embed: embed),
-          BotREsponse.new(embed: embed) ]
+          BotResponse.new(embed: embed) ]
+      else
+        teams = Team.where(id: in_team.map(&:team_id)).map(&:name)
+        embed = team_alert(character, teams)
+
+        BotResponse.new(embed: embed, reactions: Emoji::REQUEST)
       end
     # Move character to active
     when /active/i