<commit_before>def revive(user, channel, timestamp)
  channel_id = channel.id.to_s
  user_id = user.id.to_s
  if $players.key?(user_id)
    if $players[user_id].key?('death_time')
      if TimeDifference.between(
        $players[user_id]['death_time'], timestamp
      ).in_minutes > 5
        $players[user_id] = $players[user_id].without(
          'death_time'
        )
        if $cur_unst.key?(channel_id)
          if $cur_unst[channel_id].key?('is_dead')
            $cur_unst[channel_id]['is_dead'][user_id] = false
          else
            $cur_unst[channel_id]['is_dead'] = {
              user_id => false
            }
          end
        end
        $players[user_id]['current_hp'] = $players[user_id]['max_hp']
      end
    elsif $players[user_id]['current_hp'] < 0
      $players[user_id]['current_hp'] = $players[user_id]['max_hp']
    end
  end
end<commit_msg>make a check if the key exists first<commit_after>def revive(user, channel, timestamp)
  channel_id = channel.id.to_s
  user_id = user.id.to_s
  if $players.key?(user_id)
    if $players[user_id].key?('death_time')
      if TimeDifference.between(
        $players[user_id]['death_time'], timestamp
      ).in_minutes > 5
        $players[user_id] = $players[user_id].without(
          'death_time'
        )
        if $cur_unst.key?(channel_id)
          if $cur_unst[channel_id].key?('is_dead')
            $cur_unst[channel_id]['is_dead'][user_id] = false
          else
            $cur_unst[channel_id]['is_dead'] = {
              user_id => false
            }
          end
        end
        $players[user_id]['current_hp'] = $players[user_id]['max_hp']
      end
    elsif $players[user_id].key?('current_hp')
      $players[user_id]['current_hp'] = $players[user_id]['max_hp'] if $players[user_id]['current_hp'] < 0
    end
  end
end
{'fraction_non_alphanumeric': 0.14254505734571274, 'fraction_numerical': 0.002184598580010923, 'mean_word_length': 2.599214145383104, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1169284', 'n_tokens_mistral': 658, 'n_tokens_neox': 659, 'n_words': 96}